mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 843004 - Make detecting-ful evaluations of undefined properties in self-hosted code not warn, so that self-hosted code can use that pattern when it wants to. r=jorendorff
--HG-- extra : rebase_source : da9765d3ccf46758101d082b01de761c5ceed14e
This commit is contained in:
parent
2814aad186
commit
6aacab6b24
@ -4200,6 +4200,14 @@ GetPropertyHelperInline(JSContext *cx,
|
||||
if (!script || script->warnedAboutUndefinedProp())
|
||||
return true;
|
||||
|
||||
/*
|
||||
* Don't warn in self-hosted code (where the further presence of
|
||||
* JS::ContextOptions::werror() would result in impossible-to-avoid
|
||||
* errors to entirely-innocent client code).
|
||||
*/
|
||||
if (script->selfHosted())
|
||||
return true;
|
||||
|
||||
/* We may just be checking if that object has an iterator. */
|
||||
if (JSID_IS_ATOM(id, cx->names().iteratorIntrinsic))
|
||||
return true;
|
||||
|
0
js/src/tests/Intl/extensions/browser.js
Normal file
0
js/src/tests/Intl/extensions/browser.js
Normal file
@ -0,0 +1,29 @@
|
||||
// |reftest| skip-if(!xulRuntime.shell)
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 843004;
|
||||
var summary =
|
||||
"Use of an object that emulates |undefined| as the sole option must " +
|
||||
"preclude imputing default values";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
var opt = objectEmulatingUndefined();
|
||||
opt.toString = function() { return "long"; };
|
||||
|
||||
var str = new Date(2013, 12 - 1, 14).toLocaleString("en-US", { weekday: opt });
|
||||
|
||||
// Because "weekday" was present and not undefined (stringifying to "long"),
|
||||
// this must be a string like "Saturday" (in this implementation, that is).
|
||||
assertEq(str, "Saturday");
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
0
js/src/tests/Intl/extensions/shell.js
Normal file
0
js/src/tests/Intl/extensions/shell.js
Normal file
@ -0,0 +1,27 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 843004;
|
||||
var summary =
|
||||
"Don't emit a strict warning for the undefined-property detection pattern in self-hosted code";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
options("strict", "werror");
|
||||
|
||||
// Don't strict-warn (and throw, because of strict) when self-hosted code uses
|
||||
// detecting-safe undefined-property accesses (|options.weekday !== undefined|
|
||||
// and similar in ToDateTimeOptions, to be precise).
|
||||
new Date().toLocaleString("en-US", {});
|
||||
|
||||
// If we get here, the test passed.
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
Loading…
Reference in New Issue
Block a user