Commit Graph

57 Commits

Author SHA1 Message Date
Matthew Wein
c26b978847 Bug 1302898 - Rename 'restrictions' to 'allowedContexts' r=kmag
All tests pass locally.

MozReview-Commit-ID: 5dPPthlPT6i
2016-09-19 17:36:46 -07:00
Matthew Wein
fec69037f1 Bug 1302898 - Make the schema restrictions array non-nullable. r=kmag
MozReview-Commit-ID: Lk8TGsqC4WC
2016-09-14 17:02:06 -07:00
Kris Maglione
31297b2525 Bug 1298939: Don't initialize APIs that the extension does not have permissions for. r=rpl
MozReview-Commit-ID: Y0MTBL1z2O
2016-09-01 13:04:54 -07:00
Kris Maglione
386a89d124 Bug 1265371: Refactor schema parsing to reduce cyclomatic complexity. r=bsilverberg
MozReview-Commit-ID: HzVrf4yG7hZ
2016-08-30 12:24:32 -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
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
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
Rob Wu
52997a1c5a Bug 1297202 - Support cross-namespace submodule references in schemas r=aswan
MozReview-Commit-ID: 5JfOI3i3xbW
2016-08-22 15:11:47 -07:00
Rob Wu
b37ee71c9a Bug 1293132 - Document and enforce contract for Schemas.inject and Schemas.normalize r=kmag
MozReview-Commit-ID: KgSrgHttwrI
2016-08-07 18:36:36 -07:00
Sebastian Hengst
4efcf6be95 Backed out changeset d71c400313a2 (bug 1293132) for failing test_ext_schemas_api_injection.js on Android's Sets test. r=backout 2016-08-18 18:27:34 +02:00
Rob Wu
cfcfbf0fa2 Bug 1293132 - Document contract for Schemas.inject and Schemas.normalize r=kmag
MozReview-Commit-ID: KgSrgHttwrI
2016-08-07 18:36:36 -07:00
Rob Wu
5d41ba7ac3 Bug 1295473 - Fix return type of {tabs,runtime}.sendMessage r=billm
The tabs.sendMessage and runtime.sendMessage implementations behave like
an async function: They take a callback parameter and return a promise.
So they should be handled by |callAsyncFunction|, not
|callFunctionNoReturn|.

This fixes the issue for background pages, but not for content scripts
because sendMessage is not implemented as a schema at the moment. This
will also be fixed once content script APIs are generated via Schemas.

MozReview-Commit-ID: 9p1hvOP0KSm
2016-08-15 23:53:24 -07:00
Luca Greco
248525c5e7 Bug 1290901 - [webext] Allow "events" and "properties" in SubModuleType defined in JSON schema. r=aswan
MozReview-Commit-ID: Pd0pMu2VB0
2016-07-21 17:20:25 +02:00
Luca Greco
c2292f3b1f Bug 1290901 - [webext] Handle nested namespaced API schema. r=aswan
MozReview-Commit-ID: H26E8ZwLrqJ
2016-08-15 15:34:43 +02:00
Kris Maglione
aeb04c78d9 Bug 1263011: Part 2 - Implement WebExtensions Experiments prototype. r=aswan
MozReview-Commit-ID: 4KO4cCLRsLf
2016-08-05 14:20:54 -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
Matthew Wein
e3d00b8074 Bug 1285063 - Part 2: Switch to using the Category Manager to register scripts/schemas in order to load them in time for Fennec. r=kmag
MozReview-Commit-ID: 2U8cTYeH8kg
2016-07-22 12:44:40 -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
Martin Giger
fccc9c078a Bug 1279562 - Accept negative 'left' and 'top' values in chrome.windows.update. r=kmag 2016-06-17 02:22:00 -04: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
975a0065a1 Bug 1271785: [webext] Better error messages for "choices" schema types. r=aswan
The generated messages are still a bit rough in some instances, but they're at
least much better than what we have now.

MozReview-Commit-ID: gTS0RvDnwk
2016-06-04 23:31:35 -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
f61f60b7e6 Bug 1254194: [webext] Allow extensions to register custom content security policies. r=billm f=aswan
MozReview-Commit-ID: 8L6ZsyDjIpf
2016-04-23 21:29:15 -07:00
Kris Maglione
ec185ce217 Bug 1254194: [webext] Add 'onError' schema option to make manifest errors non-fatal. r=aswan
MozReview-Commit-ID: ByGsO4WFcOU
2016-04-14 16:39:09 -07:00
Bill McCloskey
f43508ae12 Bug 1197346 - Allow browser.storage to be used from content scripts (r=kmag) 2016-04-23 20:04:30 -07:00
Bill McCloskey
fcf9677d02 Bug 1197346 - Add callFunctionNoReturn (r=kmag) 2016-04-23 20:04:29 -07:00
Bob Silverberg
2199a9f406 Bug 1263637 - Fix eslint 2 warnings for WebExtensions code. r=kmag
MozReview-Commit-ID: CNLX3xjIoNV
2016-04-18 09:08:05 -04:00
Andrew Swan
39e7f61107 Bug 1251766 - Add new Date type to webextensions schemas. r=kmag
MozReview-Commit-ID: EEX5FziiINo
2016-03-04 13:08:19 -08:00
Kris Maglione
2d83ab587e Bug 1214955: [webext] Automatically localize all localizable manifest properties. r=billm
MozReview-Commit-ID: 2kvYT44NIE8
2016-02-29 19:34:49 -08:00
Kris Maglione
55354c26e2 Bug 1213993: [webext] Support frameId/allFrames/runAt in browser.tabs.executeScript and insertCSS. r=billm
MozReview-Commit-ID: FgV9vyHVjj8
2016-02-08 17:40:02 -08:00
Matthew Wein
657500c828 Bug 1243602 - don't expose browser.* properties that lack required permissions. r=kmag 2016-02-24 18:08:59 -08:00
Bill McCloskey
6b7dbef7ba Bug 1246787 - Fix rebasing error 2016-02-11 14:01:29 -08:00
Bill McCloskey
10a764ce9d Bug 1246787 - Fix ESLint errors 2016-02-11 13:37:44 -08:00
Bill McCloskey
e0f8de3c70 Bug 1246787 - [webext] Add schema storage.json (r=kmag) 2016-02-11 13:04:31 -08:00
Kris Maglione
923fcfb938 Bug 1244474: [webext] Part 1 - Add "deprecated" property support to schema validator. r=billm 2016-02-10 16:32:58 -08:00
Kris Maglione
c71b8aa2e6 Bug 1234020: Part 1 - [webext] Add initial binding-level promise<->callback support. r=billm 2016-02-01 19:20:13 -08:00
Kris Maglione
72237129ca Bug 1244805: [webext] Don't resolve relative URLs in manifests unless extension is running. r=billm 2016-02-01 11:02:02 -08:00
Kris Maglione
aaa7c2d387 Bug 1225715: Part 5 - Add schema for extension manifests. r=billm
This currently forbids unknown top-level schema properties, and unknown
permissions. In the future, I'd like to make those warnings rather than
errors, for compatibility purposes, but I think errors are fine for now.
2016-01-30 10:27:02 -08:00
Kris Maglione
66200c72ef Bug 1225715: Part 4 - Improve reporting of schema errors. r=billm 2016-01-29 20:11:07 -08:00
Kris Maglione
bcc6d8cec0 Bug 1225715: Part 3 - Allow extending existing schema types. r=billm
This one's a bit weird. I was trying to avoid it for a while, but when we
start to support different sets of APIs on different apps, it's going make it
complicated to maintain a single, centralized manifest schema without some way
for them to directly extend it.
2016-01-20 22:46:37 -08:00
Kris Maglione
ed96a63537 Bug 1225715: Part 2 - Add string format support to schemas. r=billm 2016-01-29 19:48:57 -08:00
Kris Maglione
aac8f08d11 Bug 1225715: Part 1 - Add support for patterned strings and properties in schemas. r=billm 2016-01-29 19:45:16 -08:00
Kris Maglione
cb2bf096f9 Bug 1190680: Part 2 - [webext] Add initial support for lastError callbacks. r=billm 2016-01-29 18:38:08 -08:00
Bill McCloskey
37ea2fa726 Bug 1208257 - [webext] extension.json (r=kmag) 2015-12-23 08:57:13 -08:00
Bill McCloskey
4b8e226fb9 Bug 1208257 - [webext] context_menus.json (r=kmag) 2015-12-23 08:57:13 -08:00
Bill McCloskey
8beda44f2f Bug 1208257 - [webext] browser_action.json (r=kmag) 2015-12-23 08:57:13 -08:00