mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 455553 - Part 3 - about:newtab integration; r=fryn,gavin
This commit is contained in:
parent
111ff84020
commit
e037ba800a
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://browser/content/utilityOverlay.js"/>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://browser/content/utilityOverlay.js"/>
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../common.js" />
|
src="../common.js" />
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://browser/content/utilityOverlay.js"/>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var gOpenerWnd = window.opener.wrappedJSObject;
|
var gOpenerWnd = window.opener.wrappedJSObject;
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://browser/content/utilityOverlay.js"/>
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../common.js" />
|
src="../common.js" />
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://browser/content/utilityOverlay.js"/>
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
src="../common.js" />
|
src="../common.js" />
|
||||||
|
@ -1110,5 +1110,11 @@ pref("prompts.tab_modal.enabled", true);
|
|||||||
// Whether the Panorama should animate going in/out of tabs
|
// Whether the Panorama should animate going in/out of tabs
|
||||||
pref("browser.panorama.animate_zoom", true);
|
pref("browser.panorama.animate_zoom", true);
|
||||||
|
|
||||||
|
// Defines the url to be used for new tabs.
|
||||||
|
pref("browser.newtab.url", "about:blank");
|
||||||
|
|
||||||
|
// Toggles the content of 'about:newtab'. Shows the grid when enabled.
|
||||||
|
pref("browser.newtabpage.enabled", false);
|
||||||
|
|
||||||
// Enable the DOM full-screen API.
|
// Enable the DOM full-screen API.
|
||||||
pref("full-screen-api.enabled", true);
|
pref("full-screen-api.enabled", true);
|
||||||
|
@ -225,7 +225,7 @@ var FullZoom = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Avoid the cps roundtrip and apply the default/global pref.
|
// Avoid the cps roundtrip and apply the default/global pref.
|
||||||
if (aURI.spec == "about:blank") {
|
if (isBlankPageURL(aURI.spec)) {
|
||||||
this._applyPrefToSetting(undefined, aBrowser);
|
this._applyPrefToSetting(undefined, aBrowser);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1012,7 +1012,7 @@ var PlacesStarButton = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We can load about:blank before the actual page, but there is no point in handling that page.
|
// We can load about:blank before the actual page, but there is no point in handling that page.
|
||||||
if (this._uri.spec == "about:blank") {
|
if (isBlankPageURL(this._uri.spec)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +174,9 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
|
||||||
|
"resource:///modules/NewTabUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "InspectorUI", function() {
|
XPCOMUtils.defineLazyGetter(this, "InspectorUI", function() {
|
||||||
let tmp = {};
|
let tmp = {};
|
||||||
Cu.import("resource:///modules/inspector.jsm", tmp);
|
Cu.import("resource:///modules/inspector.jsm", tmp);
|
||||||
@ -188,6 +191,7 @@ XPCOMUtils.defineLazyGetter(this, "Tilt", function() {
|
|||||||
|
|
||||||
let gInitialPages = [
|
let gInitialPages = [
|
||||||
"about:blank",
|
"about:blank",
|
||||||
|
"about:newtab",
|
||||||
"about:privatebrowsing",
|
"about:privatebrowsing",
|
||||||
"about:sessionrestore"
|
"about:sessionrestore"
|
||||||
];
|
];
|
||||||
@ -1707,6 +1711,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gBrowserThumbnails.init();
|
gBrowserThumbnails.init();
|
||||||
|
NewTabUtils.init();
|
||||||
TabView.init();
|
TabView.init();
|
||||||
|
|
||||||
setUrlAndSearchBarWidthForConditionalForwardButton();
|
setUrlAndSearchBarWidthForConditionalForwardButton();
|
||||||
@ -2204,7 +2209,7 @@ function openLocation() {
|
|||||||
else {
|
else {
|
||||||
// If there are no open browser windows, open a new one
|
// If there are no open browser windows, open a new one
|
||||||
win = window.openDialog("chrome://browser/content/", "_blank",
|
win = window.openDialog("chrome://browser/content/", "_blank",
|
||||||
"chrome,all,dialog=no", "about:blank");
|
"chrome,all,dialog=no", BROWSER_NEW_TAB_URL);
|
||||||
win.addEventListener("load", openLocationCallback, false);
|
win.addEventListener("load", openLocationCallback, false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -2222,7 +2227,7 @@ function openLocationCallback()
|
|||||||
|
|
||||||
function BrowserOpenTab()
|
function BrowserOpenTab()
|
||||||
{
|
{
|
||||||
openUILinkIn("about:blank", "tab");
|
openUILinkIn(BROWSER_NEW_TAB_URL, "tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from the openLocation dialog. This allows that dialog to instruct
|
/* Called from the openLocation dialog. This allows that dialog to instruct
|
||||||
@ -2557,7 +2562,7 @@ function URLBarSetURI(aURI) {
|
|||||||
else
|
else
|
||||||
value = losslessDecodeURI(uri);
|
value = losslessDecodeURI(uri);
|
||||||
|
|
||||||
valid = (uri.spec != "about:blank");
|
valid = !isBlankPageURL(uri.spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
gURLBar.value = value;
|
gURLBar.value = value;
|
||||||
@ -2874,7 +2879,7 @@ function getMeOutOfHere() {
|
|||||||
// Get the start page from the *default* pref branch, not the user's
|
// Get the start page from the *default* pref branch, not the user's
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
var prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||||
.getService(Ci.nsIPrefService).getDefaultBranch(null);
|
.getService(Ci.nsIPrefService).getDefaultBranch(null);
|
||||||
var url = "about:blank";
|
var url = BROWSER_NEW_TAB_URL;
|
||||||
try {
|
try {
|
||||||
url = prefs.getComplexValue("browser.startup.homepage",
|
url = prefs.getComplexValue("browser.startup.homepage",
|
||||||
Ci.nsIPrefLocalizedString).data;
|
Ci.nsIPrefLocalizedString).data;
|
||||||
@ -5191,7 +5196,7 @@ nsBrowserAccess.prototype = {
|
|||||||
case Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW :
|
case Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW :
|
||||||
// FIXME: Bug 408379. So how come this doesn't send the
|
// FIXME: Bug 408379. So how come this doesn't send the
|
||||||
// referrer like the other loads do?
|
// referrer like the other loads do?
|
||||||
var url = aURI ? aURI.spec : "about:blank";
|
var url = aURI ? aURI.spec : BROWSER_NEW_TAB_URL;
|
||||||
// Pass all params to openDialog to ensure that "url" isn't passed through
|
// Pass all params to openDialog to ensure that "url" isn't passed through
|
||||||
// loadOneOrMoreURIs, which splits based on "|"
|
// loadOneOrMoreURIs, which splits based on "|"
|
||||||
newWindow = openDialog(getBrowserURL(), "_blank", "all,dialog=no", url, null, null, null);
|
newWindow = openDialog(getBrowserURL(), "_blank", "all,dialog=no", url, null, null, null);
|
||||||
@ -5224,7 +5229,7 @@ nsBrowserAccess.prototype = {
|
|||||||
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
|
let loadInBackground = gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground");
|
||||||
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
|
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
|
||||||
|
|
||||||
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
|
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : BROWSER_NEW_TAB_URL, {
|
||||||
referrerURI: referrer,
|
referrerURI: referrer,
|
||||||
fromExternal: isExternal,
|
fromExternal: isExternal,
|
||||||
inBackground: loadInBackground});
|
inBackground: loadInBackground});
|
||||||
@ -7773,9 +7778,11 @@ function undoCloseWindow(aIndex) {
|
|||||||
*/
|
*/
|
||||||
function isTabEmpty(aTab) {
|
function isTabEmpty(aTab) {
|
||||||
let browser = aTab.linkedBrowser;
|
let browser = aTab.linkedBrowser;
|
||||||
|
let uri = browser.currentURI.spec;
|
||||||
|
let body = browser.contentDocument.body;
|
||||||
return browser.sessionHistory.count < 2 &&
|
return browser.sessionHistory.count < 2 &&
|
||||||
browser.currentURI.spec == "about:blank" &&
|
isBlankPageURL(uri) &&
|
||||||
!browser.contentDocument.body.hasChildNodes() &&
|
(!body || !body.hasChildNodes()) &&
|
||||||
!aTab.hasAttribute("busy");
|
!aTab.hasAttribute("busy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@
|
|||||||
autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
|
autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
|
||||||
delete this.mBrowser.registeredOpenURI;
|
delete this.mBrowser.registeredOpenURI;
|
||||||
}
|
}
|
||||||
if (aLocation.spec != "about:blank") {
|
if (!isBlankPageURL(aLocation.spec)) {
|
||||||
autocomplete.registerOpenPage(aLocation);
|
autocomplete.registerOpenPage(aLocation);
|
||||||
this.mBrowser.registeredOpenURI = aLocation;
|
this.mBrowser.registeredOpenURI = aLocation;
|
||||||
}
|
}
|
||||||
@ -1065,7 +1065,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title && title != "about:blank") {
|
if (title && !isBlankPageURL(title)) {
|
||||||
// At this point, we now have a URI.
|
// At this point, we now have a URI.
|
||||||
// Let's try to unescape it using a character set
|
// Let's try to unescape it using a character set
|
||||||
// in case the URI is not ASCII.
|
// in case the URI is not ASCII.
|
||||||
@ -1589,7 +1589,7 @@
|
|||||||
aTab.closing = true;
|
aTab.closing = true;
|
||||||
this._removingTabs.push(aTab);
|
this._removingTabs.push(aTab);
|
||||||
if (newTab)
|
if (newTab)
|
||||||
this.addTab("about:blank", {skipAnimation: true});
|
this.addTab(BROWSER_NEW_TAB_URL, {skipAnimation: true});
|
||||||
else
|
else
|
||||||
this.tabContainer.updateVisibility();
|
this.tabContainer.updateVisibility();
|
||||||
|
|
||||||
|
@ -41,11 +41,23 @@
|
|||||||
|
|
||||||
// Services = object with smart getters for common XPCOM services
|
// Services = object with smart getters for common XPCOM services
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () {
|
||||||
|
return Services.prefs.getCharPref("browser.newtab.url") || "about:blank";
|
||||||
|
});
|
||||||
|
|
||||||
var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
|
var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
|
||||||
|
|
||||||
var gBidiUI = false;
|
var gBidiUI = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the given url is considered a special URL for new tabs.
|
||||||
|
*/
|
||||||
|
function isBlankPageURL(aURL) {
|
||||||
|
return aURL == "about:blank" || aURL == BROWSER_NEW_TAB_URL;
|
||||||
|
}
|
||||||
|
|
||||||
function getBrowserURL()
|
function getBrowserURL()
|
||||||
{
|
{
|
||||||
return "chrome://browser/content/browser.xul";
|
return "chrome://browser/content/browser.xul";
|
||||||
@ -299,7 +311,7 @@ function openLinkIn(url, where, params) {
|
|||||||
else
|
else
|
||||||
w.gBrowser.selectedBrowser.focus();
|
w.gBrowser.selectedBrowser.focus();
|
||||||
|
|
||||||
if (!loadInBackground && url == "about:blank")
|
if (!loadInBackground && isBlankPageURL(url))
|
||||||
w.focusAndSelectUrlBar();
|
w.focusAndSelectUrlBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,8 @@ static RedirEntry kRedirMap[] = {
|
|||||||
{ "home", "chrome://browser/content/aboutHome.xhtml",
|
{ "home", "chrome://browser/content/aboutHome.xhtml",
|
||||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||||
nsIAboutModule::ALLOW_SCRIPT },
|
nsIAboutModule::ALLOW_SCRIPT },
|
||||||
|
{ "newtab", "chrome://browser/content/newtab/newTab.xul",
|
||||||
|
nsIAboutModule::ALLOW_SCRIPT },
|
||||||
{ "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
|
{ "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
|
||||||
nsIAboutModule::ALLOW_SCRIPT },
|
nsIAboutModule::ALLOW_SCRIPT },
|
||||||
};
|
};
|
||||||
|
@ -143,6 +143,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
|||||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sync-progress", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sync-progress", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
||||||
#endif
|
#endif
|
||||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
||||||
|
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
||||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
|
||||||
#if defined(XP_WIN) && !defined(__MINGW32__)
|
#if defined(XP_WIN) && !defined(__MINGW32__)
|
||||||
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
|
{ NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
|
||||||
|
Loading…
Reference in New Issue
Block a user