зеркало из https://github.com/mozilla/gecko-dev.git
Bug 791670 - part 3 - fix newtab page tests; r=jaws
This commit is contained in:
Родитель
73acc55f39
Коммит
33a343345c
|
@ -30,6 +30,9 @@ let gGrid = {
|
||||||
*/
|
*/
|
||||||
get sites() [cell.site for each (cell in this.cells)],
|
get sites() [cell.site for each (cell in this.cells)],
|
||||||
|
|
||||||
|
// Tells whether the grid has already been initialized.
|
||||||
|
get ready() !!this._node,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the grid.
|
* Initializes the grid.
|
||||||
* @param aSelector The query selector of the grid.
|
* @param aSelector The query selector of the grid.
|
||||||
|
|
|
@ -50,7 +50,10 @@ let gPage = {
|
||||||
* Updates the whole page and the grid when the storage has changed.
|
* Updates the whole page and the grid when the storage has changed.
|
||||||
*/
|
*/
|
||||||
update: function Page_update() {
|
update: function Page_update() {
|
||||||
gGrid.refresh();
|
// The grid might not be ready yet as we initialize it asynchronously.
|
||||||
|
if (gGrid.ready) {
|
||||||
|
gGrid.refresh();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,6 +33,8 @@ const EXPECTED_REFLOWS = [
|
||||||
"onxbltransitionend@chrome://browser/content/tabbrowser.xml|"
|
"onxbltransitionend@chrome://browser/content/tabbrowser.xml|"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PREF_PRELOAD = "browser.newtab.preload";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test ensures that there are no unexpected
|
* This test ensures that there are no unexpected
|
||||||
* uninterruptible reflows when opening new tabs.
|
* uninterruptible reflows when opening new tabs.
|
||||||
|
@ -40,6 +42,9 @@ const EXPECTED_REFLOWS = [
|
||||||
function test() {
|
function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
|
Services.prefs.setBoolPref(PREF_PRELOAD, false);
|
||||||
|
registerCleanupFunction(() => Services.prefs.clearUserPref(PREF_PRELOAD));
|
||||||
|
|
||||||
// Add a reflow observer and open a new tab.
|
// Add a reflow observer and open a new tab.
|
||||||
docShell.addWeakReflowObserver(observer);
|
docShell.addWeakReflowObserver(observer);
|
||||||
BrowserOpenTab();
|
BrowserOpenTab();
|
||||||
|
|
|
@ -15,4 +15,5 @@ function runTests() {
|
||||||
ok(NewTabUtils.allPages.enabled, "page is enabled");
|
ok(NewTabUtils.allPages.enabled, "page is enabled");
|
||||||
NewTabUtils.allPages.enabled = false;
|
NewTabUtils.allPages.enabled = false;
|
||||||
ok(getGrid().node.hasAttribute("page-disabled"), "page is disabled");
|
ok(getGrid().node.hasAttribute("page-disabled"), "page is disabled");
|
||||||
|
NewTabUtils.allPages.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ function runTests() {
|
||||||
yield countFocus(1);
|
yield countFocus(1);
|
||||||
|
|
||||||
Services.prefs.clearUserPref("accessibility.tabfocus");
|
Services.prefs.clearUserPref("accessibility.tabfocus");
|
||||||
|
NewTabUtils.allPages.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -227,7 +227,10 @@ function addNewTabPageTab() {
|
||||||
executeSoon(TestRunner.next);
|
executeSoon(TestRunner.next);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
TestRunner.next();
|
// It's important that we call next() asynchronously.
|
||||||
|
// 'yield addNewTabPageTab()' would fail if next() is called
|
||||||
|
// synchronously because the iterator is already executing.
|
||||||
|
executeSoon(TestRunner.next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче