Commit Graph

163 Commits

Author SHA1 Message Date
Rob Wu
4d5d4452a8 Bug 1286124 - Part 2/2 - Do not deliver messages to the sender's frame r=kmag
MozReview-Commit-ID: 8xZPDIJyMEo
2016-07-13 21:33:56 -07:00
Rob Wu
4014c9af7b Bug 1287010 - s/Extension:RemoveListener/API:RemoveListener/ r=billm
This fix is not related to the referenced bug but came up during review.

MozReview-Commit-ID: IjrxWzkLIq1
2016-08-24 16:09:43 -07:00
Rob Wu
8eb396a770 Bug 1287010 - Add test for SchemaAPIManager's loadScript r=billm
And change `this.global.Object.create(null)` to
`Cu.createObjectIn(this.global)`. The tests pass either way, but
`Cu.createObjectIn` is more explicit.

MozReview-Commit-ID: LmL6rTru5zZ
2016-08-24 15:40:35 -07:00
Rob Wu
becfb68e93 Bug 1287010 - Refactor shouldInject / pathObj r=billm
Split the `shouldInject` method into separate methods:
- `shouldInject` to determine whether the API (or namespace)
  should be injected.
- `getImplementation` to return the actual implementation.

Introduced `SchemaAPIInterface` for documentation purposes, and
two concrete implementations `LocalAPIImplementation` and
`ProxyAPIImplementation` which provide the functionality to run a local
and remote implementation of the API for which the schema API is
generated, respectively. These classes store the necessary details for
the invocation, so the methods that were formerly in the `Context` in
Schemas.jsm no longer get the `pathObj`, `path` or `name` parameters.

And merge the `path` and `name` in the implementation of remote APIs
because there is no need for having them separate, as the callers and
callees often did redundant pre/post-processing on `data.path` because
of the way it was implemented.

MozReview-Commit-ID: isbG9i9pNP
2016-08-24 01:03:49 -07:00
Rob Wu
a430263825 Bug 1287010 - Use sandbox instead of JSM for global separation r=billm
MozReview-Commit-ID: GSqmh0xC2hW
2016-08-23 16:19:33 -07:00
Rob Wu
fc61c013eb Bug 1287010 - Prepare for moving content script APIs to schemas r=billm
- By default, schema APIs are not injected in content scripts unless
  the JSON schema sets the "restrictions" attribute to `["content"]`.
- Added the "restrictions" attribute to the storage and test schemas.
  Other APIs will follow in subsequent commits and make use of the
  primitives introduced in this commit.

MozReview-Commit-ID: 1rNjQap0BiM
2016-08-18 17:46:57 -07:00
Rob Wu
488a453294 Bug 1287010 - Move Management logic to SchemaAPIManager r=billm
- Moved Management logic to ExtensionUtils (as SchemaAPIManager) so that
  the logic can be used by addon and content processes.
- Remove the `context.extension.hasPermission(api.permission)` check in
  `generateAPIs` because the only user (`registeredPrivilegedAPI`) was
  removed before in bug 1295082.
- Add new category "webextension-scripts-content", intended for
  registering the few scripts that must be loaded in a content process.

MozReview-Commit-ID: 81nhblV8YE6
2016-08-17 17:51:21 -07:00
Rob Wu
812e170fe8 Bug 1287010 - Make environment of Context explicit. r=billm
- Add `envType` to BaseContext.
 - Pass an explicit envType to all `registerSchemaAPI` invocations.
 - The factories passed to `registerSchemaAPI` will be split up later, so
   that content scripts (`content_child`) and addon pages can share
   common implementations.
 - The factories that implement the addon API will also be split up,
   to separate code running in the main process (`addon_parent`) from
   code running in a child process (`addon_child`).
 - Remove the use of a hardcoded list of `namespaces` from ProxyContext.
   Now `envType` is used to specify whether an API should be activated.

MozReview-Commit-ID: Jiff8HIwG92
2016-08-16 15:51:50 -07:00
Rob Wu
42e49c6137 Bug 1287010 - Add pathObj parameter to Schemas r=billm
Local wrappers currently look up the API object over and over again
whenever a schema API is invoked. This can be optimized by re-using
the lookup result from a `shouldInject` invocation, which is passed
as the `pathObj` parameter to the wrapper methods.

This commit adds the necessary changes and tests to allow this to
happen, but does not modify the wrapper in Extension.jsm yet.

Also, this construction allows the `ChildAPIManager` to use a local
implementation if available and fall back to a remote implementation
otherwise.

MozReview-Commit-ID: C9gm7A9Zppb
2016-08-19 00:35:07 -07:00
Kris Maglione
007774bc99 Bug 1259093: Follow-up: Fix another test race. r=me
MozReview-Commit-ID: 3DsTcQli8Ga
2016-08-20 14:00:37 -07:00
Kris Maglione
bfd63ddac8 Bug 1259093: Part 3 - Preload browserAction popups to prevent flicker during opening. r=Gijs r=jaws r=bwinton f=mattw
MozReview-Commit-ID: EpAKLV8VPTn
2016-08-19 12:29:11 -07:00
Rob Wu
98a49ff299 Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu
2016-08-16 14:29:52 -07:00
Rob Wu
6efdd88867 Bug 1295082 - Put Extension in BaseContext r=kmag
ExtensionContext in Extension.jsm has |extension| as an instance member,
so use it instead of passing |extension| to registerSchemaAPI's
callback.

And to make sure that this pattern also works in content processes, move
the |extension| member to BaseContext.

MozReview-Commit-ID: BgsGGCPQxJR
2016-08-15 01:04:58 -07:00
Sebastian Hengst
c7a498ffbd Backed out changeset 0ce1cc39aa3d (bug 1295082) for timing out in test_ext_schemas_api_injection.js. r=backout 2016-08-18 16:47:09 +02:00
Sebastian Hengst
ff21875b1a Backed out changeset dc7b09331202 (bug 1295082) 2016-08-18 16:46:30 +02:00
Rob Wu
7c6379abff Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu
2016-08-16 14:29:52 -07:00
Rob Wu
6189daa99f Bug 1295082 - Put Extension in BaseContext r=kmag
ExtensionContext in Extension.jsm has |extension| as an instance member,
so use it instead of passing |extension| to registerSchemaAPI's
callback.

And to make sure that this pattern also works in content processes, move
the |extension| member to BaseContext.

MozReview-Commit-ID: BgsGGCPQxJR
2016-08-15 01:04:58 -07:00
Rob Wu
bdf0a6a0a6 Bug 1287626,1288279 - Make IDs unique across processes r=billm
MozReview-Commit-ID: 78xgt8wqbng
2016-08-10 16:23:56 -07:00
Robert Helmer
c52c0f4a2c Bug 1279012 - implement onUpdateAvailable and runtime.reload() for WebExtensions r=aswan
MozReview-Commit-ID: KywrVkcRhzp
2016-08-02 09:37:01 -07:00
Wes Kocher
b9d5a32ad5 Merge inbound to central, a=merge 2016-08-12 13:44:29 -07:00
Kris Maglione
874e487954 Bug 1292369: Null out contentWindow properties when they point to a different inner window than the context belongs to. r=billm
MozReview-Commit-ID: LYQRxpU9vI8
2016-08-04 16:18:25 -07:00
Kris Maglione
d970e4c3c7 Bug 1293700: Make console object available to WebExtension internals. r=aswan
MozReview-Commit-ID: GyD4uo95gt6
2016-08-09 12:40:25 -07:00
Rob Wu
38d4ae8bfc Bug 1288276 - Close proxy context upon page reload, with tests r=billm
MozReview-Commit-ID: HB65DfQTGXd
2016-08-07 19:09:27 -07:00
Kris Maglione
aa06adc855 Bug 1290117: Call sendMessage response callback when there are no replies. r=robwu
MozReview-Commit-ID: 1BYD1CgZmvD
2016-08-06 14:21:10 -07:00
Jared Wein
ebf1ccbe46 Bug 1291855 - Enable the no-else-return rule for eslint. r=Felipe,kmag,mossop
MozReview-Commit-ID: DYOmE6xwMJh
2016-08-03 18:54:59 -04:00
Rob Wu
b52f567545 Bug 1286746 - Invoke sendMessage callback even if there are no listeners. r=kmag
MozReview-Commit-ID: HLIC3ZRcwRm
2016-07-14 20:34:40 -07:00
Rob Wu
80b02f6ee0 Bug 1286746 - Invoke port.onDisconnect if there are no onConnect listeners. r=kmag
MozReview-Commit-ID: DPs36oFm25J
2016-07-15 17:46:00 -07:00
Kris Maglione
56e8cb638f Bug 1274775 - Make sure background pages are created with a PresShell. r=billm
MozReview-Commit-ID: GLWg5aK47g5
2016-07-24 15:09:07 -07:00
Carsten "Tomcat" Book
9265f02f72 merge mozilla-inbound to mozilla-central a=merge 2016-07-21 16:24:36 +02:00
Till Schneidereit
e393dab409 Bug 911216 - Part 30: Enable SpiderMonkey Promise implementation. r=bz,efaust,bholley,Paolo,tromey,shu
Also contains folded version of the following patches that have to land at the same time with enabling the new implementation (or be backed out at the same time, if it comes to that):

Add Promise checks to test_xrayToJS.xul. r=bholley
Change Promise debugger hook tests to use Promise ctor instead of makeFakePromise. r=shu
Change DOM interface tests to assume Promise is an ES builtin, not a DOM one. r=bz
Remove some PromiseDebugging references. r=bz
Adapt promise rejections test to new xray-unwrapping error. r=bz
Fix expectations in browser_timelineMarkers tests. r=tromey
2016-07-21 12:06:30 +02:00
Rob Wu
e19087ccc7 Bug 1287245 - Ensure globally unique internal port IDs r=billm
MozReview-Commit-ID: FXNP5MadlMx
2016-07-15 21:44:03 -07:00
Iris Hsiao
5c3ef832ad Backed out changeset 7c026e26932d (bug 1287245) for Mochitest test_ext_background_runtime_connect_params.html failure 2016-07-20 11:04:45 +08:00
Rob Wu
da14dfd666 Bug 1287229 - port.disconnect should not throw r=billm
MozReview-Commit-ID: 7d8Zmb4OAd0
2016-07-15 22:46:42 -07:00
Rob Wu
ec2dab84e4 Bug 1287245 - Ensure globally unique internal port IDs r=billm
MozReview-Commit-ID: FXNP5MadlMx
2016-07-15 21:44:03 -07:00
Carsten "Tomcat" Book
e7b6762188 Backed out changeset a80fdfc128b0 (bug 911216) for high crash-rate on developers - RyanVM request 2016-07-18 16:14:59 +02:00
Carsten "Tomcat" Book
ac400ca3c2 merge mozilla-inbound to mozilla-central a=merge 2016-07-17 10:08:08 +02:00
Kris Maglione
e30a4f143e Bug 1272222: Use larger icons for browser actions in the menu panel. r=Gijs
MozReview-Commit-ID: 26lmlcrngPk
2016-07-13 15:16:00 -07:00
Till Schneidereit
b5a834f62f Bug 911216 - Part 30: Enable SpiderMonkey Promise implementation. r=bz,efaust,bholley,Paolo,tromey,shu
Also contains folded version of the following patches that have to land at the same time with enabling the new implementation (or be backed out at the same time, if it comes to that):

Add Promise checks to test_xrayToJS.xul. r=bholley
Change Promise debugger hook tests to use Promise ctor instead of makeFakePromise. r=shu
Change DOM interface tests to assume Promise is an ES builtin, not a DOM one. r=bz
Remove some PromiseDebugging references. r=bz
Adapt promise rejections test to new xray-unwrapping error. r=bz
Fix expectations in browser_timelineMarkers tests. r=tromey
2016-07-16 15:05:12 +02:00
Kris Maglione
8e28312be9 Bug 1284942: Don't fire message listeners for windows hidden in bfcache. r=aswan
MozReview-Commit-ID: KSqLt7Qqdkf
2016-07-06 17:14:02 -07:00
Matthew Wein
6206634766 Bug 1270742 - Add support for default_icon in chrome.pageAction r=kmag
MozReview-Commit-ID: D9uR0JUXJwx
2016-05-23 15:59:33 -07:00
Sebastian Hengst
1be0f90cda Backed out changeset 1008f5b88e6b (bug 1270742) for failing browser_ext_browserAction_context.js. r=backout 2016-06-24 13:00:31 +02:00
Matthew Wein
0ead67a3c6 Bug 1270742 - Add support for default_icon in chrome.pageAction. r=kmag
MozReview-Commit-ID: D9uR0JUXJwx
2016-05-23 15:59:33 -07:00
Andrew Swan
48c0798a2b Bug 1274708 Add BaseContext.jsonStringify() r=kmag
MozReview-Commit-ID: E4F1e8hDA5a
2016-06-16 08:30:58 -07:00
Kris Maglione
843973aa31 Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS
2016-06-09 17:44:47 -07:00
Sebastian Hengst
d97f588f03 Backed out changeset a00cf073f5c0 (bug 1279392) for failing mochitest test_ext_contentscript_create_iframe.html at least on Linux x64 opt. r=backout 2016-06-14 13:37:52 +02:00
Kris Maglione
b2a33e3bf1 Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS
2016-06-09 17:44:47 -07:00
Kris Maglione
4a1342c9e6 Bug 1278733: Turn on JSDoc validation, and fix basic errors in existing comments. r=aswan
MozReview-Commit-ID: EZpOyvoi2h0
2016-06-07 18:36:19 -07:00
Kris Maglione
2b1843d7c4 Bug 1265834: Follow-up: Fix JSDoc syntax. r=trivial DONTBUILD
MozReview-Commit-ID: HC2Vw3eNvlD
2016-06-07 12:53:32 -07:00
Bob Silverberg
1a7d79421b Bug 1265836 - Part 2: Change normalizeTime to return a date rather than a number. r=aswan
Also update browser.history.deleteRange to use normalizeTime

MozReview-Commit-ID: EQ3NLSIRTe8
2016-05-24 09:00:17 -04:00
Sebastian Hengst
b169ca896f Backed out changeset 800df6b80dc0 (bug 1265836) 2016-05-26 10:32:41 +02:00