Backing out bug 761620 due to Add-on SDK test failures.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user