Backed out changeset 40c1df07b407 (bug 824217)

This commit is contained in:
Josh Matthews 2012-12-28 19:13:36 -05:00
parent eda04f6f13
commit 8c6ec75b56
9 changed files with 31 additions and 108 deletions

View File

@ -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) {
if (id == sConstructor_id && !(flags & JSRESOLVE_ASSIGNING)) {
return ResolveConstructor(cx, obj, objp);
}
@ -4907,8 +4907,8 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
JSHandleId id, unsigned flags,
JSMutableHandleObject objp)
{
if (!JSID_IS_STRING(id)) {
// Nothing to do if we're resolving a non-string property.
if ((flags & JSRESOLVE_ASSIGNING) || !JSID_IS_STRING(id)) {
// Nothing to do if we're assigning or resolving a non-string property.
return JS_TRUE;
}
@ -6732,11 +6732,13 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
}
// 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 (!(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);
}
}
if (!my_context || !my_context->IsContextInitialized()) {
@ -6781,7 +6783,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
return NS_OK;
}
if (sTop_id == id) {
if (sTop_id == id && !(flags & JSRESOLVE_ASSIGNING)) {
nsCOMPtr<nsIDOMWindow> top;
rv = win->GetScriptableTop(getter_AddRefs(top));
NS_ENSURE_SUCCESS(rv, rv);
@ -7192,7 +7194,7 @@ nsNavigatorSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsid id, uint32_t flags,
JSObject **objp, bool *_retval)
{
if (!JSID_IS_STRING(id)) {
if (!JSID_IS_STRING(id) || (flags & JSRESOLVE_ASSIGNING)) {
return NS_OK;
}
@ -8386,6 +8388,12 @@ 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) {

View File

@ -19,7 +19,6 @@ 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)

View File

@ -1,36 +0,0 @@
<!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>

View File

@ -509,6 +509,12 @@ 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++) {

View File

@ -41,8 +41,6 @@ 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 \

View File

@ -1,30 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
Worker = 17;
var desc = Object.getOwnPropertyDescriptor(window, "Worker");
is(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>

View File

@ -1,28 +0,0 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
var desc = Object.getOwnPropertyDescriptor(window, "Worker");
is(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>

View File

@ -2529,7 +2529,7 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
return false;
JS_ValueToBoolean(cx, v, &b);
if (b) {
if (b && (flags & JSRESOLVE_ASSIGNING) == 0) {
if (!JS_ResolveStandardClass(cx, obj, id, &resolved))
return false;
if (resolved) {
@ -4583,6 +4583,9 @@ 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;

View File

@ -945,6 +945,9 @@ 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;