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.
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+
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.