Commit graph

132 commits

Author SHA1 Message Date
Luca Greco
1618aa7ef4 Bug 1252215 - [webext] Fix promiseAddonStartup defined in xpcshell tests. r=kmag
MozReview-Commit-ID: BXYXHDrG6zL

--HG--
extra : rebase_source : a93d664d78ffc416d08e1bab3058be153ae560f7
2016-09-01 19:42:41 +02:00
Luca Greco
c7c1214f36 Bug 1252215 - [webext] Add Embedded Extensions helper to LegacyExtensionsUtils. r=aswan,kmag
This patch introduces helper for the embedding of a webextension (and new related tests).

The new exported helpers are going to be integrated in the XPIProvider
to provide the Embedded WebExtension to the Legacy Extensions which
have enabled it in their install.rdf

MozReview-Commit-ID: 7M1DRkXjGat

--HG--
extra : rebase_source : 3226a83652b97601d9d4d34693761cfc720735a0
2016-08-29 15:56:02 +02:00
Luca Greco
9226a7b2f4 Bug 1252215 - [webext] LegacyExtensionsUtils JSM module and LegacyExtensionContext helper. r=aswan,kmag
- this new module contains helpers to be able to receive connections
  originated from a webextension context from a legacy extension context
  (implemented by the `LegacyExtensionContext` class exported from
  this new jsm module)

- two new test files (an xpcshell-test and a mochitest-browser) ensures that the LegacyExtensionContext can receive a Port
  object and exchange messages with a background page and a content script (the content script test
  is in a different test file because it doesn't currently work on android, because it needs
  the browser.tabs API and the TabManager internal helper)

MozReview-Commit-ID: DS1NTXk0fB6

--HG--
extra : rebase_source : 462d6a461167e317297d204e72c2f6773bc5c770
2016-08-24 18:31:36 +02:00
Phil Ringnalda
20770f2762 Back out 73e11489018d (bug 1220136) for Windows failures in test_ext_management_uninstall_self.js 2016-09-03 11:03:29 -07:00
Bob Silverberg
55812c7f73 Bug 1299846 - Complete the implementation of chrome.idle.queryState, r=kmag
MozReview-Commit-ID: jYsePeTluZ

--HG--
extra : rebase_source : 56da3e22cdd1d3f28a8f56ae969be63af4995432
2016-09-01 09:28:56 -04:00
Bob Silverberg
0fbf9fe3b6 Bug 1220136 - WebExtensions support chrome.management.uninstallSelf, r=kmag
MozReview-Commit-ID: L80ynbuFr7U

--HG--
extra : rebase_source : e01716a71bf84fbbb9e8640463f74df66fbb8540
2016-08-15 15:32:36 -04: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
Kris Maglione
11b59ae527 Bug 1298810: Pass Port object to listeners on native messaging ports. r=rpl
MozReview-Commit-ID: 1saUOB1jyE1

--HG--
extra : rebase_source : 8831300c38bcca9283c25049c463d2b6cf41380d
extra : histedit_source : 3171045999ce6619f5e77af328c90ab3f8fbf994
2016-08-29 13:12:16 -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
6a21e0fb1b Bug 1286124 - Part 1/2 - Modify existing tests to not use same-frame messaging r=kmag
MozReview-Commit-ID: CtCcajKYAoR

--HG--
extra : rebase_source : 80fda91586e917b77f2a3df8e3ad24cc1433b38d
2016-07-13 16:25:58 -07:00
Shubheksha Jalan
63373e4352 Bug 1282978 - Accept and ignore the minimum_chrome_version manifest property. r=kmag
MozReview-Commit-ID: C9AlxpQDCnC
***
Bug 1282978 - Fixed tabs and spacing issues

MozReview-Commit-ID: 3SSpQpvZY2B

--HG--
extra : rebase_source : e1f8e0378c7c78f01fff7251463af0715c3a3abe
2016-08-30 00:40:33 +05:30
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
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
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
Ryan VanderMeulen
69113163cf Merge m-c to inbound. a=merge 2016-08-24 09:09:05 -04:00
Andrew Swan
30f2e473c0 Bug 1297229 Run experiments APIs through schemas r=kmag
It is not directly related to the current bug but I added a test
for browser.extentionTypes while I was here.

MozReview-Commit-ID: 2XifKm3ZhrY

--HG--
extra : rebase_source : 855e44ebf7d595211de46a0ecbfedca107430662
2016-08-22 16:50:32 -07:00
Rob Wu
4b607a2721 Bug 1297202 - Support cross-namespace submodule references in schemas r=aswan
MozReview-Commit-ID: 5JfOI3i3xbW

--HG--
extra : rebase_source : 48aad5003198fe9ec101b5b96c0b5fccd26c08d9
2016-08-22 15:11:47 -07:00
Kris Maglione
c2bdf6f2ff Bug 1296934: Prevent background pages from showing up in global history. r=gabor
MozReview-Commit-ID: GRIJwCsfqVB

--HG--
extra : rebase_source : c58ac81f7eaab5e88cd701cd9949a8d6c064ddc6
extra : amend_source : 3aee83ced4a164ad1cf15be554820552593898ca
2016-08-21 12:43:50 -07:00
Ryan VanderMeulen
833833b8c5 Merge inbound to m-c. a=merge 2016-08-22 09:40:41 -04:00
Rob Wu
53ae1a1256 Bug 1286712 - Validate runtime.sendMessage parameters r=billm
The main motive for this patch is to remove the use of the GlobalManager
global (which was used to see if an extension ID is valid, which was
specifically added in order to create thebrowser_ext_lastError.js test).
To preserve test coverage I implemented a full validation of the
runtime.sendMessage method.

Now the error for a non-existent extension is identical in both the
content script and background pages. Note that this also fixes a
minor privacy leak: Previously extensions could see whether another
extension is installed by sending a message to the specified extension
and using the different responses to see whether another extension is
installed.

MozReview-Commit-ID: 82R97Ei25Xr

--HG--
extra : rebase_source : 900a65e695afd6db83d5102f515dc29d46d001f1
2016-08-16 21:36:42 -07:00
Rob Wu
d8772c2374 Bug 1293132 - Document and enforce contract for Schemas.inject and Schemas.normalize r=kmag
MozReview-Commit-ID: KgSrgHttwrI

--HG--
extra : rebase_source : ab59db38073cb09ccfb8c38e76191bdc9d0cecc6
2016-08-07 18:36:36 -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
Kris Maglione
2c634c4cb0 Bug 1296888: Add "webextensions" tag to WebExtension tests. r=aswan
MozReview-Commit-ID: 3QYXtpdznrP

--HG--
extra : rebase_source : 4aacd77cd2569b9ffc3916a5db3f41dd26bc7b70
2016-08-20 15:41:31 -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
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
0077f92ec3 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

--HG--
extra : rebase_source : 7fc804e52184d59cc1dae2f299c644ed13d8a3c7
2016-08-15 23:53:24 -07:00
Luca Greco
87980ec799 Bug 1290901 - [webext] Add xpcshell test cases on nested namespaces and null/empty api objects. r=aswan
MozReview-Commit-ID: HKh3gXTk09H

--HG--
extra : rebase_source : 4c2fa93c8fb43682ed4674bc7fe27ef2b1464efb
2016-08-02 04:00:46 +02:00
Bob Silverberg
ceb06cac74 Bug 1285537 - Create schema for the management API, r=aswan
MozReview-Commit-ID: EXmIv7TwmaK

--HG--
extra : rebase_source : 01ac96558bed9e752298557794cf60fb40c34518
extra : source : 1b7557775b6a5e2ef94fd6f257b76644794f5f75
2016-07-18 17:15:54 -04:00
Andrew Swan
b904b2d437 Bug 1286908 Remove id allocation from SpecialPowers loadExtension() r=kmag
Prior to this change, SpecialPowers used the extension id to identiy
extension instances in inter-process messaging.  This required that
an id be allocated from the content process side when loadExtension()
was called, but that made it impossible to test code that exercises the
code path in the AddonManager that allocates ids for extensions that do
not include an id in the manifest (it also made the loadExtension() api
clunky).

With this change, SpecialPowers allocates an internal identifier for
messaging, but this identifier is separate from extension ids.
Confusingly, we still store the actual extension id in an id property
on the object returned by loadExtension(), but there are enough tests
that reference this that it would be unnecessarily disruptive to get
rid of it so it stays for now...

MozReview-Commit-ID: G6xk1mBJJL8

--HG--
extra : rebase_source : a0891e5ba308972c35813f55274badf9edde62f7
extra : source : e8818ef3c28489e196d1db92cabf224861b693c9
2016-08-02 16:04:37 -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
Kris Maglione
73b1b5f221 Bug 1263011: Part 2 - Implement WebExtensions Experiments prototype. r=aswan
MozReview-Commit-ID: 4KO4cCLRsLf

--HG--
extra : rebase_source : 40e5ec808e557e845a771bb21e8863a8edcd4faf
2016-08-05 14:20:54 -07:00
Kris Maglione
c9c66a60a7 Bug 1291199: Retry subprocess perf tests on failure. r=aswan
MozReview-Commit-ID: 9PDT9tcYFqf

--HG--
extra : rebase_source : 6c69e13162a5849cb7cd0205ed94da322c158f38
2016-08-02 15:37:34 -07:00
Kris Maglione
60ab72068a Bug 1290598: Move slower native messaging tests to a separate unit. r=aswan
MozReview-Commit-ID: 2kXbNae1bmR

--HG--
rename : toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js => toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js
extra : rebase_source : 78b52ed4262ce8b2d262de7578519d9725ab14ec
extra : source : 577158be08e8c1211ffa1198a21e3c059f98f477
2016-07-29 14:35:04 -07:00
Kris Maglione
8fd3690336 Bug 1290598: Migrate native messaging tests to xpcshell. r=aswan
MozReview-Commit-ID: 4Uz73l8qGVE

--HG--
extra : rebase_source : f24e9cc3bd9b235a429d5bbe8e6cad509495f24f
extra : source : 486639a0f3ca05afaf0250b514c3641805f1f497
2016-08-02 17:39:51 -07:00
Kris Maglione
9d0ae0450e Bug 1290598: Refactor native messaging test setup code into separate head file. r=aswan
MozReview-Commit-ID: BN9oeXt79eG

--HG--
rename : toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js => toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js
extra : rebase_source : a0b0a1b5ca2caa772e216d059515ace89e582e1e
extra : source : 3f6f0dc1663cb5cd175f8809c3d3312df1535823
2016-07-29 14:42:03 -07:00
Carsten "Tomcat" Book
10f9f468e4 Backed out changeset 3f6f0dc1663c (bug 1290598) for xpcshell timeouts in test_ext_native_messaging.js
--HG--
rename : toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js => toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js
2016-08-03 15:12:57 +02:00
Carsten "Tomcat" Book
4e7abad957 Backed out changeset 486639a0f3ca (bug 1290598) 2016-08-03 15:12:31 +02:00
Carsten "Tomcat" Book
f8a2c19083 Backed out changeset 577158be08e8 (bug 1290598) 2016-08-03 15:12:29 +02:00
Kris Maglione
39b267f680 Bug 1290598: Move slower native messaging tests to a separate unit. r=aswan
MozReview-Commit-ID: 2kXbNae1bmR

--HG--
rename : toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js => toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js
extra : rebase_source : f977940505b7280432dd60802df10a302110f7fa
2016-07-29 14:35:04 -07:00
Kris Maglione
5bca7590fc Bug 1290598: Migrate native messaging tests to xpcshell. r=aswan
MozReview-Commit-ID: 4Uz73l8qGVE

--HG--
extra : rebase_source : 648a0975f8245e42fb1c4afadb841d9990f84714
2016-08-02 17:39:51 -07:00
Kris Maglione
588403959f Bug 1290598: Refactor native messaging test setup code into separate head file. r=aswan
MozReview-Commit-ID: BN9oeXt79eG

--HG--
rename : toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js => toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js
extra : rebase_source : 6702a92e4e083cdd2ccc9aaefa479fd31b70e181
2016-07-29 14:42:03 -07: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
4a1b1d6416 Bug 1288912: Follow-up: Skip native messaging tests on Android.
MozReview-Commit-ID: JYcUirnAfqw
2016-07-29 13:09:59 -07:00
Kris Maglione
2cb56b7b11 Bug 1288912: Add tests for native messaging round trip time. r=aswan
MozReview-Commit-ID: 6gOpZhvAZUE

--HG--
extra : rebase_source : 14cb6641ae00087c173da3d39c278802ac779a7b
2016-07-28 20:54:40 -07:00
Kris Maglione
55707f2b84 Bug 1288885: Migrate simple extension mochitests to xpcshell. r=aswan
MozReview-Commit-ID: BiaTf6u43XP

--HG--
rename : toolkit/components/extensions/test/mochitest/test_ext_background_runtime_connect_params.html => toolkit/components/extensions/test/xpcshell/test_ext_background_runtime_connect_params.js
rename : toolkit/components/extensions/test/mochitest/test_ext_extension.html => toolkit/components/extensions/test/xpcshell/test_ext_extension.js
rename : toolkit/components/extensions/test/mochitest/test_ext_idle.html => toolkit/components/extensions/test/xpcshell/test_ext_idle.js
rename : toolkit/components/extensions/test/mochitest/test_ext_onmessage_removelistener.html => toolkit/components/extensions/test/xpcshell/test_ext_onmessage_removelistener.js
rename : toolkit/components/extensions/test/mochitest/test_ext_runtime_getPlatformInfo.html => toolkit/components/extensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js
rename : toolkit/components/extensions/test/mochitest/test_ext_runtime_sendMessage.html => toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js
rename : toolkit/components/extensions/test/mochitest/test_ext_simple.html => toolkit/components/extensions/test/xpcshell/test_ext_simple.js
extra : rebase_source : a4931c7a6165193c45ea99538d4cc8300317929f
extra : amend_source : eb3ec077285d7ad83b89b6f1a8df73230a58ab20
extra : intermediate-source : af745bd5c20928ef776a7c94c76cb9c87ac77c71
extra : source : f9fd137c9691e75d9e01d61be14608e7f28c7815
2016-07-22 16:57:58 -07:00
Kris Maglione
6cab484667 Fix botched backout for changeset af745bd5c209 (bug 1288885)
MozReview-Commit-ID: KCC6FQ0yn45

--HG--
extra : amend_source : 1d7255b7fa215407c958d3ba51915f22461d6526
2016-07-28 13:49:38 -07:00
Kris Maglione
55cbd3e601 Backed out changeset af745bd5c209 for xpcshell test failures.
MozReview-Commit-ID: Dt6n5mRFLgN

--HG--
extra : amend_source : 2be72943ed781129bed07c3723d87b0f3d7eca9c
2016-07-28 13:42:02 -07:00