Closed Bug 1277135 Opened 8 years ago Closed 8 years ago

Add an rval argument to JS::CloneAndExecuteScript()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

Details

(Whiteboard: [v8api])

Attachments

(1 file)

      No description provided.
Attachment #8758520 - Flags: review?(jorendorff)
Whiteboard: [v8api]
Assignee: nobody → ehsan
Comment on attachment 8758520 [details] [diff] [review]
Add an rval argument to JS::CloneAndExecuteScript()

Review of attachment 8758520 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the change mentioned below.

::: js/src/jsapi-tests/testScriptObject.cpp
@@ +202,5 @@
> +        cls_CloneAndExecuteScript other;
> +        other.rt = rt;
> +        CHECK(other.setup());
> +        {
> +            JSAutoCompartment ac(cx, global);

Was this supposed to say `other.global`?

I think instead of factoring out setup/teardown and using an extra cls_CloneAndExecuteScript object, I would write this:

    {
        JS::RootedObject global2(cx, createGlobal());
        CHECK(global2);
        JSAutoCompartment ac(cx, global2);
        ...
    }

It seems shorter and more to the point; also, we've just eliminated support for multiple contexts on the same thread.
Attachment #8758520 - Flags: review?(jorendorff) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/317aecd284b8
Add an rval argument to JS::CloneAndExecuteScript(); r=jorendorff
https://hg.mozilla.org/mozilla-central/rev/317aecd284b8
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: