Bug 1039881 - Use an empty directory tiles data source pref before uplift [r=adw r=bholley a=lmandel]
Update tests to use a dummy pref, so it changes no matter what's the default.
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1494,17 +1494,17 @@ pref("browser.newtab.preload", true);
pref("browser.newtabpage.enabled", true);
// number of rows of newtab grid
pref("browser.newtabpage.rows", 3);
// number of columns of newtab grid
pref("browser.newtabpage.columns", 3);
-pref("browser.newtabpage.directory.source", "chrome://global/content/directoryLinks.json");
+pref("browser.newtabpage.directory.source", "data:application/json,{}");
// Enable the DOM fullscreen API.
pref("full-screen-api.enabled", true);
// True if the fullscreen API requires approval upon a domain entering fullscreen.
// Domains that have already had fullscreen permission granted won't re-request
// approval.
pref("full-screen-api.approval-required", true);
--- a/browser/base/content/test/general/browser_tabopen_reflows.js
+++ b/browser/base/content/test/general/browser_tabopen_reflows.js
@@ -102,18 +102,18 @@ function test() {
// Remove reflow observer and clean up.
docShell.removeWeakReflowObserver(observer);
gBrowser.removeCurrentTab();
finish();
});
});
Services.prefs.setBoolPref(PREF_PRELOAD, false);
- // set directory source to empty links
- Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, "data:application/json,{}");
+ // set directory source to dummy/empty links
+ Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, 'data:application/json,{"test":1}');
}
let observer = {
reflow: function (start, end) {
// Gather information about the current code path.
let path = (new Error().stack).split("\n").slice(1).map(line => {
return line.replace(/:\d+:\d+$/, "");
}).join("|");
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -84,17 +84,18 @@ function watchLinksChangeOnce() {
* Provide the default test function to start our test runner.
*/
function test() {
waitForExplicitFinish();
// start TestRunner.run() after directory links is downloaded and written to disk
watchLinksChangeOnce().then(() => {
TestRunner.run();
});
- Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, "data:application/json,{}");
+ // set directory source to dummy/empty links
+ Services.prefs.setCharPref(PREF_NEWTAB_DIRECTORYSOURCE, 'data:application/json,{"test":1}');
}
/**
* The test runner that controls the execution flow of our tests.
*/
let TestRunner = {
/**
* Starts the test runner.
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2342,16 +2342,18 @@ nsGlobalWindow::SetNewDocument(nsIDocume
if (aForceReuseInnerWindow &&
!wouldReuseInnerWindow &&
mDoc &&
mDoc->NodePrincipal() != aDocument->NodePrincipal()) {
NS_ERROR("Attempted forced inner window reuse while changing principal");
return NS_ERROR_UNEXPECTED;
}
+ NS_ENSURE_TRUE(GetContextInternal(), NS_ERROR_NOT_INITIALIZED);
+
nsCOMPtr<nsIDocument> oldDoc = mDoc;
#ifndef MOZ_DISABLE_CRYPTOLEGACY
// clear smartcard events, our document has gone away.
if (mCrypto && XRE_GetProcessType() != GeckoProcessType_Content) {
nsresult rv = mCrypto->SetEnableSmartCardEvents(false);
NS_ENSURE_SUCCESS(rv, rv);
}