Commit graph

115 commits

Author SHA1 Message Date
Kris Maglione
6eea09ec68 Bug 1298939: Don't register cleanup functions for listeners until the first time they're added. r=rpl
MozReview-Commit-ID: Ai8MxlB2qSb

--HG--
extra : rebase_source : 8bcfc534acff00448c34fe2e5dc51c1d27df9db1
2016-08-26 16:58:54 -07:00
Kris Maglione
7fd9caf08b Bug 1298939: Don't initialize APIs that the extension does not have permissions for. r=rpl
MozReview-Commit-ID: Y0MTBL1z2O

--HG--
extra : rebase_source : f68463dca5dfffd19aa833402ac7599a15f92843
2016-09-01 13:04:54 -07:00
Rob Wu
13d2c8e67f Bug 1286124 - Part 2/2 - Do not deliver messages to the sender's frame r=kmag
MozReview-Commit-ID: 8xZPDIJyMEo

--HG--
extra : rebase_source : 87fe85ef4786bfe8092569361557eb17f3471276
2016-07-13 21:33:56 -07:00
Rob Wu
364b810c75 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

--HG--
extra : rebase_source : d53179af98106049bcf1a12efed74c4527ac62c1
2016-08-24 16:09:43 -07:00
Rob Wu
6576d65005 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

--HG--
extra : rebase_source : 4cf7b1463bf8b6882b6fd453657eae0ff43ed64d
2016-08-24 15:40:35 -07:00
Rob Wu
e080d5603d 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

--HG--
extra : rebase_source : 22cdc3ab3d14c6381f9f540739d6750281ae8c71
2016-08-24 01:03:49 -07:00
Rob Wu
bef0b5a7ac Bug 1287010 - Use sandbox instead of JSM for global separation r=billm
MozReview-Commit-ID: GSqmh0xC2hW

--HG--
extra : rebase_source : 9b23172c205a1e4ef49f018eb2fbd5d9bd207adc
2016-08-23 16:19:33 -07:00
Rob Wu
8053e5a9c0 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

--HG--
extra : rebase_source : bf2c7fb70a38fbf13cdfd4337cb3cb6fef7e67e8
2016-08-18 17:46:57 -07:00
Rob Wu
b21d936ca3 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

--HG--
extra : rebase_source : d2eee0298ad5038225ea56c2e752532af0bc6fb7
2016-08-17 17:51:21 -07:00
Rob Wu
be3652cd57 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

--HG--
extra : rebase_source : 946a3c0009a4e3223c2d10044b3099a94c845394
2016-08-16 15:51:50 -07:00
Rob Wu
1067b066d5 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

--HG--
extra : rebase_source : e2ab1e40de72fdea23acc9a68f3cf7d77e3da66f
2016-08-19 00:35:07 -07:00
Kris Maglione
dbc9f1910b Bug 1259093: Follow-up: Fix another test race. r=me
MozReview-Commit-ID: 3DsTcQli8Ga

--HG--
extra : rebase_source : e32b68893d6684211cd752b88967f7cc74600faa
2016-08-20 14:00:37 -07:00
Kris Maglione
e9d8b48ce4 Bug 1259093: Part 3 - Preload browserAction popups to prevent flicker during opening. r=Gijs r=jaws r=bwinton f=mattw
MozReview-Commit-ID: EpAKLV8VPTn

--HG--
extra : rebase_source : 6ce6e622734214c7214fc2ddb7ddb2233fc0c8fd
2016-08-19 12:29:11 -07:00
Rob Wu
3451c2f756 Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu

--HG--
extra : rebase_source : 07ea6252ab49d992ff17db77dea5840732f478c4
2016-08-16 14:29:52 -07:00
Rob Wu
bacc209644 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

--HG--
extra : rebase_source : 7aa9fb7a53e057e8d3d8c477bd6821f8344c571a
2016-08-15 01:04:58 -07:00
Sebastian Hengst
2164cd95c8 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
3b39ae834c Backed out changeset dc7b09331202 (bug 1295082) 2016-08-18 16:46:30 +02:00
Rob Wu
62ec179344 Bug 1295082 - BaseContext.extensionId -> BaseContext.extension.id r=kmag
MozReview-Commit-ID: 2tFVUwjyJQu

--HG--
extra : rebase_source : 7091f5f8f52b158912fb503626a20d82db2142f8
2016-08-16 14:29:52 -07:00
Rob Wu
dfc11d6f00 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

--HG--
extra : rebase_source : 9a85d95f0c147198938b86c57127f6e7403fd53c
2016-08-15 01:04:58 -07:00
Rob Wu
0765167097 Bug 1287626,1288279 - Make IDs unique across processes r=billm
MozReview-Commit-ID: 78xgt8wqbng

--HG--
extra : rebase_source : 2f88ba3d4c8198038f2ce3f849bad2baca48df4a
2016-08-10 16:23:56 -07:00
Robert Helmer
bcf92a01fd Bug 1279012 - implement onUpdateAvailable and runtime.reload() for WebExtensions r=aswan
MozReview-Commit-ID: KywrVkcRhzp

--HG--
extra : rebase_source : e51f67f76f3b3ac845b2d2f3ba8c36005c43c2c1
2016-08-02 09:37:01 -07:00
Wes Kocher
e9097643d5 Merge inbound to central, a=merge 2016-08-12 13:44:29 -07:00
Kris Maglione
026f92fc96 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

--HG--
extra : rebase_source : 88aa9e5eb14d22696126c26f960edbc40e923b89
extra : histedit_source : 01ff56be73b884fe73f4543b875acf37a1469b3d
2016-08-04 16:18:25 -07:00
Kris Maglione
d16036cec9 Bug 1293700: Make console object available to WebExtension internals. r=aswan
MozReview-Commit-ID: GyD4uo95gt6

--HG--
extra : rebase_source : a1bb70bbc186c76d5c0437530662b0754516ea7b
extra : histedit_source : d8bf619ce3d39987b2850223ccb3f28a82cbc532
2016-08-09 12:40:25 -07:00
Rob Wu
c35dc1dca7 Bug 1288276 - Close proxy context upon page reload, with tests r=billm
MozReview-Commit-ID: HB65DfQTGXd

--HG--
extra : rebase_source : c00cdcf8d11f80b1f69f4958b9035e343c2b134b
2016-08-07 19:09:27 -07:00
Kris Maglione
617494218f Bug 1290117: Call sendMessage response callback when there are no replies. r=robwu
MozReview-Commit-ID: 1BYD1CgZmvD

--HG--
extra : rebase_source : dc6297a85062c6713fa808f935ec7051d8668dc1
extra : amend_source : e398638f70f95835c7a8f8e94ea6945fa763ccb6
2016-08-06 14:21:10 -07:00
Jared Wein
871ed4e3ba Bug 1291855 - Enable the no-else-return rule for eslint. r=Felipe,kmag,mossop
MozReview-Commit-ID: DYOmE6xwMJh

--HG--
extra : rebase_source : bc81b68ea5599fd1815dc34dac7106eef7044483
2016-08-03 18:54:59 -04:00
Rob Wu
b82e0653f4 Bug 1286746 - Invoke sendMessage callback even if there are no listeners. r=kmag
MozReview-Commit-ID: HLIC3ZRcwRm

--HG--
extra : transplant_source : %BCJ%CC%00%E7N%92%B1%10%81%EDLd%85V%85%9E%0C%03%06
extra : histedit_source : 8689d6860cd7acca6ada8271d7297c0ec4a3a863
2016-07-14 20:34:40 -07:00
Rob Wu
7b06f057c9 Bug 1286746 - Invoke port.onDisconnect if there are no onConnect listeners. r=kmag
MozReview-Commit-ID: DPs36oFm25J

--HG--
extra : transplant_source : y%D0%5CF9%8C%FB%C9%D72%A2g%CF%AD-d%89%2B%FC%14
extra : histedit_source : 34050222a86d7e6c25f94e21dfe498e1cda98e8a
2016-07-15 17:46:00 -07:00
Kris Maglione
fba8996a05 Bug 1274775 - Make sure background pages are created with a PresShell. r=billm
MozReview-Commit-ID: GLWg5aK47g5

--HG--
extra : rebase_source : 472365762aca534e826173989c48f5058960a987
2016-07-24 15:09:07 -07:00
Carsten "Tomcat" Book
4a64baa9d4 merge mozilla-inbound to mozilla-central a=merge 2016-07-21 16:24:36 +02:00
Till Schneidereit
f8bc4fae19 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
40ef620db2 Bug 1287245 - Ensure globally unique internal port IDs r=billm
MozReview-Commit-ID: FXNP5MadlMx

--HG--
extra : rebase_source : b96ddf1898adcedce9bea40f5b1283f8f27485ef
2016-07-15 21:44:03 -07:00
Iris Hsiao
23202d54b2 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
fcbcffffd6 Bug 1287229 - port.disconnect should not throw r=billm
MozReview-Commit-ID: 7d8Zmb4OAd0

--HG--
extra : rebase_source : 6766832c0081679eadf1bdbc1576f8b554c68e3c
2016-07-15 22:46:42 -07:00
Rob Wu
28a234ae47 Bug 1287245 - Ensure globally unique internal port IDs r=billm
MozReview-Commit-ID: FXNP5MadlMx

--HG--
extra : rebase_source : fc9bf0f2dff872536430c1da3bacbc29dff7b14a
2016-07-15 21:44:03 -07:00
Carsten "Tomcat" Book
779d97cbaf 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
a0992595d6 merge mozilla-inbound to mozilla-central a=merge 2016-07-17 10:08:08 +02:00
Kris Maglione
63c5aef93a Bug 1272222: Use larger icons for browser actions in the menu panel. r=Gijs
MozReview-Commit-ID: 26lmlcrngPk

--HG--
extra : rebase_source : b9d6bfb7669d3cb826ccaa6728e153ad3e3b2b8b
2016-07-13 15:16:00 -07:00
Till Schneidereit
3a9eed06fe 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
005248648e Bug 1284942: Don't fire message listeners for windows hidden in bfcache. r=aswan
MozReview-Commit-ID: KSqLt7Qqdkf

--HG--
extra : rebase_source : 0b1322a7a4b6db5992bbe1cfc73975e2ed64035e
2016-07-06 17:14:02 -07:00
Matthew Wein
569e667c08 Bug 1270742 - Add support for default_icon in chrome.pageAction r=kmag
MozReview-Commit-ID: D9uR0JUXJwx

--HG--
extra : transplant_source : %FC%FBu%0Cboh%DFv%BB%8D%AC%20%ED%A5%E1%3E%DE%126
2016-05-23 15:59:33 -07:00
Sebastian Hengst
2e51abafdb 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
48b0f752e6 Bug 1270742 - Add support for default_icon in chrome.pageAction. r=kmag
MozReview-Commit-ID: D9uR0JUXJwx

--HG--
extra : transplant_source : %D2%EEUA%D1%C7Yp%88E%851%200n%90%D7%8F%0C%F4
2016-05-23 15:59:33 -07:00
Andrew Swan
8bf4c1d66e Bug 1274708 Add BaseContext.jsonStringify() r=kmag
MozReview-Commit-ID: E4F1e8hDA5a

--HG--
extra : rebase_source : e34a87e387248051633281000fa6d9b49f6cd533
2016-06-16 08:30:58 -07:00
Kris Maglione
a1dac7caad Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS

--HG--
extra : source : a00cf073f5c00380d4e42b13bc0cd3146b708845
extra : amend_source : d74ef90e88acbe62e33af3b5b9cf870d5c0a9d3e
2016-06-09 17:44:47 -07:00
Sebastian Hengst
f8035f62a8 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
b465305345 Bug 1279392: [webext] Move API permission definitions to the schemas. r=aswan
MozReview-Commit-ID: 8m7wJrAbFwS

--HG--
extra : rebase_source : cba877c0ef400917b0b7e5913895e64ebefb34b9
extra : amend_source : 6e943015e3e00854c431cbd653994a6734e66ce4
2016-06-09 17:44:47 -07:00
Kris Maglione
5d03979f6b Bug 1278733: Turn on JSDoc validation, and fix basic errors in existing comments. r=aswan
MozReview-Commit-ID: EZpOyvoi2h0

--HG--
extra : rebase_source : b03b211a1fe3aad3c760bd0f9235bbaaca171a9a
2016-06-07 18:36:19 -07:00
Kris Maglione
8fe5dd7de6 Bug 1265834: Follow-up: Fix JSDoc syntax. r=trivial DONTBUILD
MozReview-Commit-ID: HC2Vw3eNvlD

--HG--
extra : histedit_source : 031a665451a52e4083fc822e75d5d121673ec1f0
2016-06-07 12:53:32 -07:00