diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/modules/tests/browser/browser_PromiseMessage.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/modules/tests/browser/browser_PromiseMessage.js')
-rw-r--r-- | toolkit/modules/tests/browser/browser_PromiseMessage.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/toolkit/modules/tests/browser/browser_PromiseMessage.js b/toolkit/modules/tests/browser/browser_PromiseMessage.js new file mode 100644 index 000000000..e967ac4c9 --- /dev/null +++ b/toolkit/modules/tests/browser/browser_PromiseMessage.js @@ -0,0 +1,38 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* global Cu, BrowserTestUtils, is, ok, add_task, gBrowser */ +"use strict"; +Cu.import("resource://gre/modules/PromiseMessage.jsm", this); + + +const url = "http://example.org/tests/dom/manifest/test/resource.sjs"; + +/** + * Test basic API error conditions + */ +add_task(function* () { + yield BrowserTestUtils.withNewTab({gBrowser, url}, testPromiseMessageAPI) +}); + +function* testPromiseMessageAPI(aBrowser) { + // Reusing an existing message. + const msgKey = "DOM:WebManifest:hasManifestLink"; + const mm = aBrowser.messageManager; + const id = "this should not change"; + const foo = "neitherShouldThis"; + const data = {id, foo}; + + // This just returns false, and it doesn't matter for this test. + yield PromiseMessage.send(mm, msgKey, data); + + // Check that no new props were added + const props = Object.getOwnPropertyNames(data); + ok(props.length === 2, "There should only be 2 props"); + ok(props.includes("id"), "Has the id property"); + ok(props.includes("foo"), "Has the foo property"); + + // Check that the props didn't change. + is(data.id, id, "The id prop must not change."); + is(data.foo, foo, "The foo prop must not change."); +} |