Commit graph

420 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
Rob Wu
73811a0f67 Bug 1298716 - Unify use of ExtensionTestUtils.loadExtension r=billm
MozReview-Commit-ID: DT6rx6KYODl

--HG--
extra : rebase_source : b37924fe255993006fc9a7dfa115d0527d6d0e10
2016-08-28 17:22:03 -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
Ryan VanderMeulen
71d43e7c12 Merge inbound to m-c. a=merge 2016-08-30 09:52:55 -04:00
Thomas Wisniewski
756abf6cfa Bug 289714 - Do not write <parsererror> nodes for invalid XML documents in XMLHttpRequests made by web content. r=billm, r=bz
--HG--
extra : rebase_source : 4cc87bbeca140953a90b31e1fd5b32098d37a2de
2016-08-29 16:30:36 -04: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
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
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
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
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
Rob Wu
8a0b0a5460 Bug 1288901 - Create ExtensionContext at document-element-inserted r=billm
MozReview-Commit-ID: 9ZQWmNjoAXA

--HG--
extra : rebase_source : d62d5169df1549d576e71bbc9ad51ecf0b4add9b
2016-08-07 19:10:01 -07:00
Rob Wu
6cea2d2df8 Bug 1288901 - Destroy ExtensionContext at inner window destruction instead of unload r=billm
MozReview-Commit-ID: 4JI7PpAj9xd

--HG--
extra : rebase_source : 7b4a4f1e18dd52bf7c2f430d31ebe2b5f1928fab
2016-08-07 19:09:56 -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
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
Rob Wu
bb96ed46e5 Bug 1288276 - Add tests for background page context r=billm
MozReview-Commit-ID: 8FsN8NoCreW

--HG--
extra : rebase_source : 0199e6c5ee92de23304bf00338698a213f80849a
2016-08-07 19:09:37 -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
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
Rob Wu
9069fff35f Bug 1197451 - Add clipboardWrite permission r=billm
MozReview-Commit-ID: 6d1mQSVWRPe

--HG--
extra : rebase_source : 2f19bab5c9d6db25c60b2b19c06c7027384a04ca
2016-07-08 17:19:17 -07: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
Andrew Swan
fa3c0fac00 Bug 1213990 Clear storage when webextension is uninstalled r=kmag
MozReview-Commit-ID: BeMOxOCSeru

--HG--
extra : rebase_source : 3eb7fc4e61fe1ce698e22e25bd05fc779a6cf7a8
2016-08-01 16:30:18 -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