Bug 1107609 - Simplify test_pushstate_replacestate with ContentTask. r=ttaubert r=mconley

--HG--
extra : rebase_source : 41bc60b69d662afe915ded9e7b489769d6b4c9c0
This commit is contained in:
Steven MacLeod 2015-02-11 17:15:01 -05:00
parent 848a47b780
commit b4a14b9a63
2 changed files with 6 additions and 20 deletions

View File

@ -209,9 +209,9 @@ add_task(function test_pushstate_replacestate() {
is(entries.length, 1, "there is one shistory entry");
is(entries[0].url, "http://example.com/1", "url is correct");
browser.messageManager.
sendAsyncMessage("ss-test:historyPushState", {url: 'test-entry/'});
yield promiseContentMessage(browser, "ss-test:historyPushState");
yield ContentTask.spawn(browser, {}, function* () {
content.window.history.pushState({}, "", 'test-entry/');
});
// Check that we have added the history entry.
TabState.flush(browser);
@ -219,9 +219,9 @@ add_task(function test_pushstate_replacestate() {
is(entries.length, 2, "there is another shistory entry");
is(entries[1].url, "http://example.com/test-entry/", "url is correct");
browser.messageManager.
sendAsyncMessage("ss-test:historyReplaceState", {url: 'test-entry2/'});
yield promiseContentMessage(browser, "ss-test:historyReplaceState");
yield ContentTask.spawn(browser, {}, function* () {
content.window.history.replaceState({}, "", "test-entry2/");
});
// Check that we have modified the history entry.
TabState.flush(browser);

View File

@ -239,20 +239,6 @@ addMessageListener("ss-test:click", function ({data}) {
sendAsyncMessage("ss-test:click");
});
addMessageListener("ss-test:historyPushState", function ({data}) {
content.window.history.
pushState(data.stateObj || {}, data.title || "", data.url);
sendAsyncMessage("ss-test:historyPushState");
});
addMessageListener("ss-test:historyReplaceState", function ({data}) {
content.window.history.
replaceState(data.stateObj || {}, data.title || "", data.url);
sendAsyncMessage("ss-test:historyReplaceState");
});
addMessageListener("ss-test:run", function({data, objects}) {
let f = eval('(' + data.code + ')');
let result = f(content, objects.arg);