From 5f435fdf37f5611f6d7771bf9af0b0f61ef2056f Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Wed, 18 Nov 2015 15:08:48 -0800 Subject: [PATCH] Bug 1146926: Fix SDK remote tests to pass with e10s enabled. r=gabor By not waiting for the tab to finish loading we end up accidentally killing the child process somehow and later tests that expect a child process to be present fail. --- addon-sdk/source/test/addons/e10s-remote/main.js | 7 +++++++ addon-sdk/source/test/addons/remote/main.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/addon-sdk/source/test/addons/e10s-remote/main.js b/addon-sdk/source/test/addons/e10s-remote/main.js index 1b9f08f4973..de7e7f3150e 100644 --- a/addon-sdk/source/test/addons/e10s-remote/main.js +++ b/addon-sdk/source/test/addons/e10s-remote/main.js @@ -46,6 +46,7 @@ exports["test process restart"] = function*(assert) { let tabs = getTabs(window); assert.equal(tabs.length, 1, "Should have just the one tab to start with"); let tab = tabs[0]; + let browser = getBrowserForTab(tab); let loader = new Loader(module); let { processes, frames } = yield waitForProcesses(loader); @@ -59,6 +60,7 @@ exports["test process restart"] = function*(assert) { let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach'); let frameAttach = promiseTabFrameAttach(frames); let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach'); + let browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, LOCAL_URI); // The load should kill the remote frame yield frameDetach; @@ -67,10 +69,12 @@ exports["test process restart"] = function*(assert) { assert.equal(newFrame.process, localProcess, "New frame should be in the local process"); // And kill the process yield processDetach; + yield browserLoad; frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach'); let processAttach = promiseEvent(processes, 'attach'); frameAttach = promiseTabFrameAttach(frames); + browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, REMOTE_URI); // The load should kill the remote frame yield frameDetach; @@ -80,8 +84,11 @@ exports["test process restart"] = function*(assert) { // And create a new frame in the remote process [newFrame] = yield frameAttach; assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process"); + yield browserLoad; + browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, "about:blank"); + yield browserLoad; loader.unload(); }; diff --git a/addon-sdk/source/test/addons/remote/main.js b/addon-sdk/source/test/addons/remote/main.js index 1b9f08f4973..de7e7f3150e 100644 --- a/addon-sdk/source/test/addons/remote/main.js +++ b/addon-sdk/source/test/addons/remote/main.js @@ -46,6 +46,7 @@ exports["test process restart"] = function*(assert) { let tabs = getTabs(window); assert.equal(tabs.length, 1, "Should have just the one tab to start with"); let tab = tabs[0]; + let browser = getBrowserForTab(tab); let loader = new Loader(module); let { processes, frames } = yield waitForProcesses(loader); @@ -59,6 +60,7 @@ exports["test process restart"] = function*(assert) { let frameDetach = promiseEventOnItemAndContainer(assert, remoteFrame, frames, 'detach'); let frameAttach = promiseTabFrameAttach(frames); let processDetach = promiseEventOnItemAndContainer(assert, remoteProcess, processes, 'detach'); + let browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, LOCAL_URI); // The load should kill the remote frame yield frameDetach; @@ -67,10 +69,12 @@ exports["test process restart"] = function*(assert) { assert.equal(newFrame.process, localProcess, "New frame should be in the local process"); // And kill the process yield processDetach; + yield browserLoad; frameDetach = promiseEventOnItemAndContainer(assert, newFrame, frames, 'detach'); let processAttach = promiseEvent(processes, 'attach'); frameAttach = promiseTabFrameAttach(frames); + browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, REMOTE_URI); // The load should kill the remote frame yield frameDetach; @@ -80,8 +84,11 @@ exports["test process restart"] = function*(assert) { // And create a new frame in the remote process [newFrame] = yield frameAttach; assert.equal(newFrame.process, remoteProcess, "New frame should be in the remote process"); + yield browserLoad; + browserLoad = promiseDOMEvent(browser, "load", true); setTabURL(tab, "about:blank"); + yield browserLoad; loader.unload(); };