Backing out bug 761620 due to Add-on SDK test failures.

This commit is contained in:
Dave Townsend
2012-08-15 10:31:21 -07:00
parent 8c80a16793
commit 456af059e8
3 changed files with 14 additions and 33 deletions

View File

@@ -249,20 +249,19 @@ WeakMap_set_impl(JSContext *cx, CallArgs args)
thisObj->setPrivate(map);
}
// Preserve wrapped native keys to prevent wrapper optimization.
if (key->getClass()->ext.isWrappedNative) {
MOZ_ASSERT(cx->runtime->preserveWrapperCallback, "wrapped native weak map key needs preserveWrapperCallback");
if (!cx->runtime->preserveWrapperCallback(cx, key)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_WEAKMAP_KEY);
return false;
}
}
if (!map->put(key, value)) {
JS_ReportOutOfMemory(cx);
return false;
}
// Preserve wrapped native keys to prevent wrapper optimization.
if (key->getClass()->ext.isWrappedNative) {
if (!cx->runtime->preserveWrapperCallback ||
!cx->runtime->preserveWrapperCallback(cx, key)) {
JS_ReportWarning(cx, "Failed to preserve wrapper of wrapped native weak map key.");
}
}
args.rval().setUndefined();
return true;
}