Closed Bug 1288276 Opened 8 years ago Closed 8 years ago

closeProxyContext is never invoked

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox50 affected, firefox51 fixed)

RESOLVED FIXED
mozilla51
Tracking Status
firefox50 --- affected
firefox51 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Whiteboard: triaged)

Attachments

(3 files)

http://searchfox.org/mozilla-central/rev/868b17897f7a7fcd7f6f67fd8185a7370db46604/toolkit/components/extensions/ExtensionUtils.jsm#1292
this.messageManager.sendAsyncMessage("Extension:CloseProxyContext", {childId: this.id});

does not match
http://searchfox.org/mozilla-central/rev/868b17897f7a7fcd7f6f67fd8185a7370db46604/toolkit/components/extensions/ExtensionUtils.jsm#1292
Services.mm.addMessageListener("API:CloseProxyContext", this, true);

And in an OOP world, the parent process should have minimal assumptions on the child process, in order to provide a better security. In this case, we should also dispose the proxy context if the child process terminates.
> we should also dispose the proxy context if the child process terminates.

This is already handled by subscribing to message-manager-close and disposing its associated ProxyContexts.

The patch is easy, s/Extension:/API:/.
How can I add a regression test for this bug?
Flags: needinfo?(wmccloskey)
The only way I can think of where this might go wrong is if a content script used storage.local.onChanged.addListener. When the content page navigates, we could try to see if the listener fires after that.
Flags: needinfo?(wmccloskey)
Blocks: 1288901
Whiteboard: triaged
Comment on attachment 8775374 [details]
Bug 1288276 - Add chromeScript.awaitOneMessage to SpecialPowers

https://reviewboard.mozilla.org/r/67540/#review65506

::: testing/specialpowers/content/specialpowersAPI.js:506
(Diff revision 1)
>      let chromeScript = {
>        addMessageListener: (name, listener) => {
>          listeners.push({ name: name, listener: listener });
>        },
>  
> +      awaitOneMessage: name => new Promise(resolve => {

promiseOneMessage might be a better name given how we've done stuff like this in the past.
Attachment #8775374 - Flags: review?(wmccloskey) → review+
Attachment #8775370 - Flags: review?(wmccloskey) → review+
Comment on attachment 8775369 [details]
Bug 1288276 - Close proxy context upon page reload, with tests

https://reviewboard.mozilla.org/r/67532/#review65510
Attachment #8775369 - Flags: review?(wmccloskey) → review+
Comment on attachment 8775374 [details]
Bug 1288276 - Add chromeScript.awaitOneMessage to SpecialPowers

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67540/diff/1-2/
Comment on attachment 8775369 [details]
Bug 1288276 - Close proxy context upon page reload, with tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67532/diff/1-2/
Comment on attachment 8775370 [details]
Bug 1288276 - Add tests for background page context

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67534/diff/1-2/
Keywords: checkin-needed
has problems to apply:

applying 6ed8aa4923ad
6ed8aa4923ad transplanted to 16513ef7dd8c
applying f968025c4ddc
patching file toolkit/components/extensions/test/mochitest/mochitest.ini
Hunk #1 FAILED at 29
1 out of 1 hunks FAILED -- saving rejects to file toolkit/components/extensions/test/mochitest/mochitest.ini.rej
patch failed to apply
abort: fix up the working directory and run hg transplant --continue
Flags: needinfo?(rob)
Keywords: checkin-needed
Comment on attachment 8775374 [details]
Bug 1288276 - Add chromeScript.awaitOneMessage to SpecialPowers

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67540/diff/2-3/
Comment on attachment 8775369 [details]
Bug 1288276 - Close proxy context upon page reload, with tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67532/diff/2-3/
Comment on attachment 8775370 [details]
Bug 1288276 - Add tests for background page context

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67534/diff/2-3/
Flags: needinfo?(rob)
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/2ef8ee2d4bac
Add chromeScript.awaitOneMessage to SpecialPowers. r=billm
https://hg.mozilla.org/integration/fx-team/rev/d1cd8175cc47
Close proxy context upon page reload, with tests. r=billm
https://hg.mozilla.org/integration/fx-team/rev/a32b3e3c6b34
Add tests for background page context. r=billm
Keywords: checkin-needed
backed out for failing in tests like https://treeherder.mozilla.org/logviewer.html#?job_id=10987836&repo=fx-team
Flags: needinfo?(rob)
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/697966241877
Backed out changeset a32b3e3c6b34 
https://hg.mozilla.org/integration/fx-team/rev/1e08d12783fb
Backed out changeset d1cd8175cc47 
https://hg.mozilla.org/integration/fx-team/rev/ed55a2720142
Backed out changeset 2ef8ee2d4bac for failing on own test
Tests were failing because Android does not support the tabs API. I disabled the test for Android, rebased the patch and verified locally that no test failures are generated on Fennec. Please land it again.
Flags: needinfo?(rob)
Keywords: checkin-needed
Pushed by kwierso@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/edfb98ed711e
Add chromeScript.awaitOneMessage to SpecialPowers r=billm
https://hg.mozilla.org/integration/autoland/rev/9fcfe72d38fa
Close proxy context upon page reload, with tests r=billm
https://hg.mozilla.org/integration/autoland/rev/9017c54c3f57
Add tests for background page context r=billm
Keywords: checkin-needed
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: