mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 824217 - Remove some easy-to-remove tests of JSRESOLVE_ASSIGNING. r=bz
--HG-- extra : rebase_source : 2605d559d48b9ccd985bd860f13ab7b1b53ab048
This commit is contained in:
parent
0cf6fdf7bb
commit
cec653ab7c
@ -4423,7 +4423,7 @@ nsDOMClassInfo::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
JSObject **objp, bool *_retval)
|
||||
{
|
||||
if (id == sConstructor_id && !(flags & JSRESOLVE_ASSIGNING)) {
|
||||
if (id == sConstructor_id) {
|
||||
return ResolveConstructor(cx, obj, objp);
|
||||
}
|
||||
|
||||
@ -4907,8 +4907,8 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
JSHandleId id, unsigned flags,
|
||||
JSMutableHandleObject objp)
|
||||
{
|
||||
if ((flags & JSRESOLVE_ASSIGNING) || !JSID_IS_STRING(id)) {
|
||||
// Nothing to do if we're assigning or resolving a non-string property.
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
// Nothing to do if we're resolving a non-string property.
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@ -6732,13 +6732,11 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & JSRESOLVE_ASSIGNING)) {
|
||||
// We want this code to be before the child frame lookup code
|
||||
// below so that a child frame named 'constructor' doesn't
|
||||
// shadow the window's constructor property.
|
||||
if (sConstructor_id == id) {
|
||||
return ResolveConstructor(cx, obj, objp);
|
||||
}
|
||||
// We want this code to be before the child frame lookup code
|
||||
// below so that a child frame named 'constructor' doesn't
|
||||
// shadow the window's constructor property.
|
||||
if (sConstructor_id == id) {
|
||||
return ResolveConstructor(cx, obj, objp);
|
||||
}
|
||||
|
||||
if (!my_context || !my_context->IsContextInitialized()) {
|
||||
@ -6783,7 +6781,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (sTop_id == id && !(flags & JSRESOLVE_ASSIGNING)) {
|
||||
if (sTop_id == id) {
|
||||
nsCOMPtr<nsIDOMWindow> top;
|
||||
rv = win->GetScriptableTop(getter_AddRefs(top));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -7194,7 +7192,7 @@ nsNavigatorSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, uint32_t flags,
|
||||
JSObject **objp, bool *_retval)
|
||||
{
|
||||
if (!JSID_IS_STRING(id) || (flags & JSRESOLVE_ASSIGNING)) {
|
||||
if (!JSID_IS_STRING(id)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -8388,12 +8386,6 @@ JSBool
|
||||
nsHTMLDocumentSH::DocumentAllNewResolve(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
unsigned flags, JSMutableHandleObject objp)
|
||||
{
|
||||
if (flags & JSRESOLVE_ASSIGNING) {
|
||||
// Nothing to do here if we're assigning
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
js::RootedValue v(cx);
|
||||
|
||||
if (sItem_id == id || sNamedItem_id == id) {
|
||||
|
@ -19,6 +19,7 @@ MOCHITEST_FILES = \
|
||||
test_gsp-qualified.html \
|
||||
test_nondomexception.html \
|
||||
test_screen_orientation.html \
|
||||
test_window_constructor.html \
|
||||
test_window_enumeration.html \
|
||||
test_writable-replaceable.html \
|
||||
$(NULL)
|
||||
|
36
dom/base/test/test_window_constructor.html
Normal file
36
dom/base/test/test_window_constructor.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=824217
|
||||
-->
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Test for Bug 824217</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=622491">Mozilla Bug 824217</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<iframe name="constructor" src="about:blank"></iframe>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run()
|
||||
{
|
||||
// Ideally we'd test that this property lives on the right place in the
|
||||
// [[Prototype]] chain, with the right attributes there, but we don't
|
||||
// implement this right yet, so just test the value's what's expected.
|
||||
is(window.constructor, Window,
|
||||
"should have gotten Window, not the constructor frame");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.addEventListener("load", run, false);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -509,12 +509,6 @@ ResolveWorkerClasses(JSContext* aCx, JSHandleObject aObj, JSHandleId aId, unsign
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
// Don't care about assignments, bail now.
|
||||
if (aFlags & JSRESOLVE_ASSIGNING) {
|
||||
aObjp.set(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Make sure our strings are interned.
|
||||
if (JSID_IS_VOID(gStringIDs[0])) {
|
||||
for (uint32_t i = 0; i < ID_COUNT; i++) {
|
||||
|
@ -41,6 +41,8 @@ MOCHITEST_FILES = \
|
||||
importScripts_worker_imported4.js \
|
||||
test_instanceof.html \
|
||||
instanceof_worker.js \
|
||||
test_resolveWorker.html \
|
||||
test_resolveWorker-assignment.html \
|
||||
test_json.html \
|
||||
json_worker.js \
|
||||
test_location.html \
|
||||
|
32
dom/workers/test/test_resolveWorker-assignment.html
Normal file
32
dom/workers/test/test_resolveWorker-assignment.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
window.Worker = 17; // resolve through assignment
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(window, "Worker");
|
||||
ok(typeof desc === "object" && desc !== null, "Worker property must exist");
|
||||
|
||||
is(desc.value, 17, "Overwrite didn't work correctly");
|
||||
// The JSRESOLVE_ASSIGNING flag-check around the "Resolve special classes"
|
||||
// block in nsWindowSH::NewResolve needs to die to enable this.
|
||||
todo_is(desc.enumerable, false,
|
||||
"Initial descriptor was non-enumerable, and [[Put]] changes the " +
|
||||
"property value but not its enumerability");
|
||||
is(desc.configurable, true,
|
||||
"Initial descriptor was configurable, and [[Put]] changes the " +
|
||||
"property value but not its configurability");
|
||||
is(desc.writable, true,
|
||||
"Initial descriptor was writable, and [[Put]] changes the " +
|
||||
"property value but not its writability");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
31
dom/workers/test/test_resolveWorker.html
Normal file
31
dom/workers/test/test_resolveWorker.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
window.Worker; // resolve not through assignment
|
||||
Worker = 17;
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(window, "Worker");
|
||||
ok(typeof desc === "object" && desc !== null, "Worker property must exist");
|
||||
|
||||
is(desc.value, 17, "Overwrite didn't work correctly");
|
||||
is(desc.enumerable, false,
|
||||
"Initial descriptor was non-enumerable, and [[Put]] changes the " +
|
||||
"property value but not its enumerability");
|
||||
is(desc.configurable, true,
|
||||
"Initial descriptor was configurable, and [[Put]] changes the " +
|
||||
"property value but not its configurability");
|
||||
is(desc.writable, true,
|
||||
"Initial descriptor was writable, and [[Put]] changes the " +
|
||||
"property value but not its writability");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -2529,7 +2529,7 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
return false;
|
||||
|
||||
JS_ValueToBoolean(cx, v, &b);
|
||||
if (b && (flags & JSRESOLVE_ASSIGNING) == 0) {
|
||||
if (b) {
|
||||
if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
|
||||
return false;
|
||||
if (resolved) {
|
||||
@ -4583,9 +4583,6 @@ env_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
JSString *valstr;
|
||||
const char *name, *value;
|
||||
|
||||
if (flags & JSRESOLVE_ASSIGNING)
|
||||
return true;
|
||||
|
||||
IdStringifier idstr(cx, id, true);
|
||||
if (idstr.threw())
|
||||
return false;
|
||||
|
@ -945,9 +945,6 @@ env_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags,
|
||||
{
|
||||
JSString *idstr, *valstr;
|
||||
|
||||
if (flags & JSRESOLVE_ASSIGNING)
|
||||
return true;
|
||||
|
||||
jsval idval;
|
||||
if (!JS_IdToValue(cx, id, &idval))
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user