Bug 1149162 - Remove CPOW shim usage in SDK test-tab test related to tab.readyState. r=Mossop

MozReview-Commit-ID: Cg0koZxzSxp

--HG--
extra : rebase_source : 59d8d5029df84017b825309c7422799c518d0397
This commit is contained in:
Luca Greco 2016-08-29 20:03:42 +02:00
parent b847ec2cfd
commit a3ad81ea5c

View File

@ -202,13 +202,26 @@ exports["test tab.readyState"] = (assert, done) => {
});
}
exports["test tab.readyState for existent tabs"] = (assert) => {
exports["test tab.readyState for existent tabs"] = function* (assert) {
assert.equal(tabs.length, 1, "tabs contains an existent tab");
function frameScript() {
sendAsyncMessage("test:contentDocument.readyState", content.document.readyState);
}
for (let tab of tabs) {
let browserForTab = getBrowserForTab(viewFor(tab));
assert.equal(browserForTab.contentDocument.readyState, tab.readyState,
"tab.readyState has the same value of the associated contentDocument.readyState CPOW");
let mm = browserForTab.messageManager;
yield new Promise((resolve) => {
mm.addMessageListener("test:contentDocument.readyState", function listener(evt) {
mm.removeMessageListener("test:contentDocument.readyState", listener);
assert.equal(evt.data, tab.readyState,
"tab.readyState has the same value of the associated contentDocument.readyState CPOW");
resolve();
});
mm.loadFrameScript(`data:,new ${frameScript};`, false);
});
}
}