mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1022002 - make cloneInto create functions that clone their arguments, r=bholley
This commit is contained in:
parent
f7c610d4d2
commit
9255c62f6f
@ -3531,7 +3531,7 @@ CloneIntoReadStructuredClone(JSContext *cx,
|
||||
if (!JS_WrapObject(cx, &obj))
|
||||
return nullptr;
|
||||
|
||||
if (!xpc::NewFunctionForwarder(cx, obj, false, &functionValue))
|
||||
if (!xpc::NewFunctionForwarder(cx, obj, true, &functionValue))
|
||||
return nullptr;
|
||||
|
||||
return &functionValue.toObject();
|
||||
|
@ -161,8 +161,14 @@
|
||||
'CloneInto should only work on less privileged target scopes.');
|
||||
}
|
||||
|
||||
var test = { a: function() { return 42; } }
|
||||
var test = { a: function() { return 42; } };
|
||||
cloneAndTestWithFunctions(test);
|
||||
|
||||
// Check that we're cloning input to functions:
|
||||
test = { a: function(obj) { return obj; } };
|
||||
var clonedTest = Cu.cloneInto(test, sandbox, {cloneFunctions: true});
|
||||
var testInput = {};
|
||||
isnot(clonedTest.a(testInput), testInput, "Objects should not be identical");
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
||||
|
Loading…
Reference in New Issue
Block a user