зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 744772 (Trace the DOM interface object array). r=bz.
--HG-- extra : rebase_source : c9f27bed0eab0e6db03295050176ef986cf0b59b
This commit is contained in:
Родитель
1c884a9386
Коммит
174872c252
|
@ -202,6 +202,20 @@ AllocateProtoOrIfaceCache(JSObject* obj)
|
|||
JS::PrivateValue(protoOrIfaceArray));
|
||||
}
|
||||
|
||||
inline void
|
||||
TraceProtoOrIfaceCache(JSTracer* trc, JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
|
||||
|
||||
JSObject** protoOrIfaceArray = GetProtoOrIfaceArray(obj);
|
||||
for (size_t i = 0; i < kProtoOrIfaceCacheCount; ++i) {
|
||||
JSObject* proto = protoOrIfaceArray[i];
|
||||
if (proto) {
|
||||
JS_CALL_OBJECT_TRACER(trc, proto, "protoOrIfaceArray[i]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
DestroyProtoOrIfaceCache(JSObject* obj)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
_TEST_FILES = \
|
||||
test_lookupGetter.html \
|
||||
test_InstanceOf.html \
|
||||
test_traceProtos.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=744772
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 744772</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=744772">Mozilla Bug 744772</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 744772 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function callback() {
|
||||
new XMLHttpRequest().upload;
|
||||
ok(true, "Accessing unreferenced DOM interface objects shouldn't crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
delete window.XMLHttpRequestUpload;
|
||||
SpecialPowers.exactGC(window, callback);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -844,6 +844,7 @@ private:
|
|||
DedicatedWorkerGlobalScope* scope =
|
||||
UnwrapDOMObject<DedicatedWorkerGlobalScope>(aObj, Class());
|
||||
if (scope) {
|
||||
mozilla::dom::TraceProtoOrIfaceCache(aTrc, aObj);
|
||||
scope->_Trace(aTrc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -695,6 +695,11 @@ TraceForValidWrapper(JSTracer *trc, XPCWrappedNative* wrapper)
|
|||
static void
|
||||
MarkWrappedNative(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
js::Class* clazz = js::GetObjectClass(obj);
|
||||
if (clazz->flags & JSCLASS_DOM_GLOBAL) {
|
||||
mozilla::dom::TraceProtoOrIfaceCache(trc, obj);
|
||||
}
|
||||
|
||||
JSObject *obj2;
|
||||
|
||||
// Pass null for the first JSContext* parameter to skip any security
|
||||
|
|
|
@ -1082,6 +1082,8 @@ TraceXPCGlobal(JSTracer *trc, JSObject *obj)
|
|||
|
||||
if (XPCWrappedNativeScope *scope = XPCWrappedNativeScope::GetNativeScope(obj))
|
||||
scope->TraceDOMPrototypes(trc);
|
||||
|
||||
mozilla::dom::TraceProtoOrIfaceCache(trc, obj);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
Загрузка…
Ссылка в новой задаче