Save globals between execute_script calls in the 'content' context

RESOLVED FIXED in mozilla15

Status

RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: jgriffin, Assigned: philikon)

Tracking

unspecified
mozilla15
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

7 years ago
Currently, each call to execute_script or execute_async_script uses a new sandbox, so the sandbox globals are not carried over, and the only way to share state between calls is to use a property on the window object.

This contaminates the page's JS context, and makes it a little more work to write tests.  We should preserve globals between calls, so that this isn't necessary.
Created attachment 621828 [details] [diff] [review]
Part 1 (v1): Reuse the content sandbox
Assignee: nobody → philipp
Attachment #621828 - Flags: review?(jgriffin)
Patch looks good to me! We just need to make sure it doesn't break any of the tests
Created attachment 622449 [details] [diff] [review]
Part 1 (v2): Reuse the content sandbox

Added the newSandbox argument to execute* calls to preserve functionality with Selenium, and updated the tests.
Attachment #621828 - Attachment is obsolete: true
Attachment #621828 - Flags: review?(jgriffin)
Attachment #622449 - Flags: review?(jgriffin)
(Reporter)

Comment 4

7 years ago
Comment on attachment 622449 [details] [diff] [review]
Part 1 (v2): Reuse the content sandbox

Looks good, and tests pass!  Let's land it and then we can update the chrome code in a separate patch.
Attachment #622449 - Flags: review?(jgriffin) → review+
(Reporter)

Comment 5

7 years ago
http://hg.mozilla.org/mozilla-central/rev/b54871d38ed1
Target Milestone: --- → mozilla15
(In reply to Jonathan Griffin (:jgriffin) from comment #4)
> Looks good, and tests pass!  Let's land it and then we can update the chrome
> code in a separate patch.

Let's do it in a separate bug. I'm not a big fan of lingering half-landed bugs. Filed bug 755036.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Summary: Save globals between execute_script calls → Save globals between execute_script calls in the 'content' context
You need to log in before you can comment on or make changes to this bug.