Back out rev 2682f9a1fc58, bug 807222, because it assumes that people aren't putting completely broken stuff on Window, which b2g does. CLOSED TREE

This commit is contained in:
Boris Zbarsky 2012-11-01 15:19:08 -04:00
parent a04e07641d
commit 68e4e059ec
5 changed files with 0 additions and 99 deletions

View File

@ -5594,48 +5594,12 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
return NS_OK;
}
struct ResolveGlobalNameClosure
{
JSContext* cx;
JSObject* obj;
bool* retval;
};
static PLDHashOperator
ResolveGlobalName(const nsAString& aName, void* aClosure)
{
ResolveGlobalNameClosure* closure =
static_cast<ResolveGlobalNameClosure*>(aClosure);
JS::Value dummy;
bool ok = JS_LookupUCProperty(closure->cx, closure->obj,
aName.BeginReading(), aName.Length(),
&dummy);
if (!ok) {
*closure->retval = false;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
nsWindowSH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, bool *_retval)
{
if (!ObjectIsNativeWrapper(cx, obj)) {
*_retval = JS_EnumerateStandardClasses(cx, obj);
if (!*_retval) {
return NS_OK;
}
// Now resolve everything from the namespace manager
nsScriptNameSpaceManager *nameSpaceManager =
nsJSRuntime::GetNameSpaceManager();
if (!nameSpaceManager) {
NS_ERROR("Can't get namespace manager.");
return NS_ERROR_UNEXPECTED;
}
ResolveGlobalNameClosure closure = { cx, obj, _retval };
nameSpaceManager->EnumerateGlobalNames(ResolveGlobalName, &closure);
}
return NS_OK;

View File

@ -793,26 +793,3 @@ nsScriptNameSpaceManager::RegisterDefineDOMInterface(const nsAFlatString& aName,
s->mPrefEnabled = aPrefEnabled;
}
}
struct GlobalNameClosure
{
nsScriptNameSpaceManager::GlobalNameEnumerator enumerator;
void* closure;
};
static PLDHashOperator
EnumerateGlobalName(PLDHashTable*, PLDHashEntryHdr *hdr, uint32_t,
void* aClosure)
{
GlobalNameMapEntry *entry = static_cast<GlobalNameMapEntry *>(hdr);
GlobalNameClosure* closure = static_cast<GlobalNameClosure*>(aClosure);
return closure->enumerator(entry->mKey, closure->closure);
}
void
nsScriptNameSpaceManager::EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
void* aClosure)
{
GlobalNameClosure closure = { aEnumerator, aClosure };
PL_DHashTableEnumerate(&mGlobalNames, EnumerateGlobalName, &closure);
}

View File

@ -143,12 +143,6 @@ public:
mozilla::dom::DefineInterface aDefineDOMInterface,
mozilla::dom::PrefEnabled aPrefEnabled);
typedef PLDHashOperator
(* GlobalNameEnumerator)(const nsAString& aGlobalName, void* aClosure);
void EnumerateGlobalNames(GlobalNameEnumerator aEnumerator,
void* aClosure);
private:
// Adds a new entry to the hash and returns the nsGlobalNameStruct
// that aKey will be mapped to. If mType in the returned

View File

@ -17,7 +17,6 @@ MOCHITEST_FILES = \
test_gsp-qualified.html \
test_nondomexception.html \
test_screen_orientation.html \
test_window_enumeration.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=807222
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 807222</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=807222">Mozilla Bug 807222</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 807222 **/
var expectedProps = [ "Image", "Audio", "Option", "USSDReceivedEvent",
"PerformanceTiming", "CSS2Properties", "SVGElement" ];
var actualProps = Object.getOwnPropertyNames(window);
for (var i = 0; i < expectedProps.length; ++i) {
isnot(actualProps.indexOf(expectedProps[i]), -1,
"getOwnPropertyNames should include " + expectedProps[i]);
}
</script>
</pre>
</body>
</html>