Commit Graph

71 Commits

Author SHA1 Message Date
Kris Maglione
30223093bd Bug 1316396: Part 4 - Refactor ChildAPIManager and sub-classes. r=aswan
MozReview-Commit-ID: LVChZtLxyNT
2016-11-10 12:29:38 -08:00
Kris Maglione
9f122d3ac9 Bug 1316396: Part 3 - Clean up the native messaging Port logic. r=aswan
MozReview-Commit-ID: E7ns3ZQl6FN
2016-11-09 12:28:09 -08:00
Kris Maglione
e80af36c5a Bug 1316396: Part 2 - Rename contexts to make it clearer how and where they're used. r=aswan
MozReview-Commit-ID: 25oSbulhCmX
2016-11-09 12:08:42 -08:00
Kris Maglione
d25b4ecf0f Bug 1316396: Part 1 - Reorganize parent, child, common, and test code into more appropriate modules. r=aswan
MozReview-Commit-ID: 5WMt69GoN3K
2016-11-10 12:35:22 -08:00
Kris Maglione
4bd88237a3 Bug 1315575: Part 2 - Stop generating multiple sets of schema bindings for proxy contexts. r=aswan
MozReview-Commit-ID: 2VqYscQAAF6
2016-11-07 22:21:01 -08:00
Kris Maglione
89425f013c Bug 1315575: Part 1 - More cleanup. r=aswan
MozReview-Commit-ID: KdAplJGH9Hy
2016-11-06 17:28:16 -08:00
Matthew Wein
bb3fd3b5a2 Bug 1247435 - Fix context.incognito (this completes part of bug 1309610) r=kmag
MozReview-Commit-ID: IFW8SfNymbE
2016-11-04 14:37:09 +00:00
Kris Maglione
bec1b361f5 Bug 1312690: Lazily initialize extension APIs. r=aswan
MozReview-Commit-ID: 2ofzT6wPvus
2016-11-02 19:21:04 -07:00
Rob Wu
21eaf53406 Bug 1299411 - Move native messaging to child process r=kmag
Move `runtime.connectNative` and `runtime.sendNativeMessage` to
`addon_child`. Note: This does not change the behavior for launching the
native app, it is still launched from the main process.

Now ExtensionUtils's Port is also used for native messaging ports. Now
the behavior of `runtime.connect` and `runtime.connectNative` are
identical from the extension's perspective.
In particular:
- `disconnect()` does not throw when called again (bug 1287229).
- `onDisconnect` is called with error messages (tests will be added in
  the next commit).

MozReview-Commit-ID: AyU9amiLeoL
2016-09-24 13:25:56 +02:00
Rob Wu
95ffcd5efd Bug 1287007 - Make window.close in extension pages async r=billm
Test coverage by tabs.onRemoved + window.close() in:
toolkit/components/extensions/test/mochitest/test_ext_tab_teardown.html

MozReview-Commit-ID: 7asg2XGrTaQ
2016-09-13 20:26:18 -07:00
Rob Wu
a5e3a4826d Bug 1287007 - Remove .contentWindow from ProxyContext r=billm
MozReview-Commit-ID: ASNigrM07yz
2016-09-13 16:02:03 -07:00
Rob Wu
433d6d6381 Bug 1287007 - Enable proxying of most APIs. r=billm
MozReview-Commit-ID: KrI42XrsVVG
2016-09-12 21:19:53 -07:00
Rob Wu
ee6c294ec5 Bug 1287007 - Set parent cloneScope to child cloneScope r=billm
This is only to help with migration. This change allows all APIs to
behave identical regardless of whether the API is proxied.

Change cloneScope to be a getter because cloneScope is
`this.contentWindow`, which may be nulled when the context navigates away
(but stays in the bfcache).

Any API that is not proxied must have an identical clone scope to make
sure that properties such as toJSON (in the native messaging
stringifier) and ArrayBuffer (in webRequest as requestBody) are visible
to the caller.

MozReview-Commit-ID: 9aT3SUBieHK
2016-09-11 03:10:21 -07:00
Rob Wu
9a18f5991f Bug 1287007 - Remove dead code r=billm
MozReview-Commit-ID: LtuKY5DjB68
2016-09-06 15:50:50 -07:00
Rob Wu
549209e57b Bug 1287007 - Use child's Extension instead of the process' r=billm
MozReview-Commit-ID: 9o8tOuUbchn
2016-09-06 15:31:33 -07:00
Rob Wu
0b6a21b18a Bug 1287007 - Use IPC to share viewType, tabId and windowId r=billm
Accessing <browser> in ContentChild does not work when extensions run in
a separate process.

MozReview-Commit-ID: EK0aOYeGaZ5
2016-09-06 15:25:10 -07:00
Rob Wu
19ac7136a0 Bug 1287007 - Move extension context initialization to ExtensionContent r=billm
This is a simple move of ExtensionContext creation logic to
ExtensionChild.

Before the change, ExtensionContext was initialized as follows:

1. (ext-backgroundPage.js) Create background page
2. (Extension.jsm) document-element-inserted observed.
3. (Extension.jsm) new ExtensionContext + unload observer.

After this commit:

1. (ext-backgroundPage.js) Create background page
2. (ext-backgroundPage.js) emit extension-browser-inserted event
3. (Extension.jsm) Pass global to ExtensionContent + unload listener.
4. (ExtensionContent.jsm) document-element-inserted observed.
5. (ExtensionChild.jsm) new ExtensionContext

The next step is to use frame scripts and synchronize state.

MozReview-Commit-ID: K6mPdq7KQ2T
2016-09-05 23:50:11 -07:00
Rob Wu
b1b009afcb Bug 1287007 - Move background page API logic to child r=billm
MozReview-Commit-ID: iGROahhkhn
2016-09-05 22:34:44 -07:00
Rob Wu
85f4c6b8ea Bug 1287007 - Rename "context.type" to "context.viewType" r=billm
"viewType" is more easily searchable and not as ambiguous as "type".

MozReview-Commit-ID: 8sG4qagFCBu
2016-09-05 22:26:56 -07:00
Rob Wu
0e978724ec Bug 1287007 - Introduce ChildAPIManager to addon code r=billm
This is the bare minimum to separate the generation of addon_parent and
addon_child APIs. Now it is possible to have methods with the same name
but different implementations in the parent and child.

Many APIs are not compatible with the proxied API implementation, so
they temporarily fall back to directly invoking the parent API, just as
before this commit.

MozReview-Commit-ID: fwuZUvD8tY
2016-09-05 18:57:38 -07:00
Rob Wu
cea9d2eac3 Bug 1287007 - Move ExtensionContext to separate file r=billm
This is just a mechanical change, literally nothing more than cutting
ExtensionContext from Extension.jsm, pasting it in ExtensionChild.jsm
and adding the minimal imoort boilerplate.

MozReview-Commit-ID: 5uVt1IOdEFU
2016-09-05 00:15:18 -07:00