Fix test --release

Unfortuantely we need to do some linking trickery to make sure a custom
section is correctly pulled in...
This commit is contained in:
Alex Crichton 2018-10-01 14:44:21 -07:00
parent a7e9da0a81
commit 8e7238d15f

View File

@ -13,6 +13,11 @@ extern "C" {
/// Returns whether it's likely we're executing in a browser environment, as
/// opposed to node.js.
// If this function is inlined then there's no other functions in this module
// (which becomes an object file) to actually pull in the custom section listed
// above. Force this to never be inlined so if this module is needed its forced
// to pull in the descriptor section from `#[wasm_bindgen]` above.
#[inline(never)]
pub fn is_browser() -> bool {
// Test whether we're in a browser by seeing if the `self` property is
// defined on the global object, which should in turn only be true in