зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1125342 - Fix intermittent browser_responsiveui.js by making the test to wait for document to load before starting the test. r=ochameau
This commit is contained in:
Родитель
3f8627eb68
Коммит
b633846f05
|
@ -42,7 +42,11 @@ function test() {
|
||||||
ok(instance, "instance of the module is attached to the tab.");
|
ok(instance, "instance of the module is attached to the tab.");
|
||||||
|
|
||||||
let originalWidth = content.innerWidth;
|
let originalWidth = content.innerWidth;
|
||||||
|
|
||||||
|
let documentLoaded = waitForDocLoadComplete();
|
||||||
content.location = "data:text/html;charset=utf-8,mop<div style%3D'height%3A5000px'><%2Fdiv>";
|
content.location = "data:text/html;charset=utf-8,mop<div style%3D'height%3A5000px'><%2Fdiv>";
|
||||||
|
yield documentLoaded;
|
||||||
|
|
||||||
let newWidth = content.innerWidth;
|
let newWidth = content.innerWidth;
|
||||||
is(originalWidth, newWidth, "Floating scrollbars are presents");
|
is(originalWidth, newWidth, "Floating scrollbars are presents");
|
||||||
|
|
||||||
|
|
|
@ -212,3 +212,32 @@ function nextTick() {
|
||||||
executeSoon(() => def.resolve())
|
executeSoon(() => def.resolve())
|
||||||
return def.promise;
|
return def.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits for the next load to complete in the current browser.
|
||||||
|
*
|
||||||
|
* @return promise
|
||||||
|
*/
|
||||||
|
function waitForDocLoadComplete(aBrowser=gBrowser) {
|
||||||
|
let deferred = promise.defer();
|
||||||
|
let progressListener = {
|
||||||
|
onStateChange: function (webProgress, req, flags, status) {
|
||||||
|
let docStop = Ci.nsIWebProgressListener.STATE_IS_NETWORK |
|
||||||
|
Ci.nsIWebProgressListener.STATE_STOP;
|
||||||
|
info("Saw state " + flags.toString(16) + " and status " + status.toString(16));
|
||||||
|
|
||||||
|
// When a load needs to be retargetted to a new process it is cancelled
|
||||||
|
// with NS_BINDING_ABORTED so ignore that case
|
||||||
|
if ((flags & docStop) == docStop && status != Cr.NS_BINDING_ABORTED) {
|
||||||
|
aBrowser.removeProgressListener(progressListener);
|
||||||
|
info("Browser loaded " + aBrowser.contentWindow.location);
|
||||||
|
deferred.resolve();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
||||||
|
Ci.nsISupportsWeakReference])
|
||||||
|
};
|
||||||
|
aBrowser.addProgressListener(progressListener);
|
||||||
|
info("Waiting for browser load");
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче