[Pkg-mozext-commits] [tabmixplus] 22/30: Pass AMO validation test for possible attempt to override new tab page
David Prévot
taffit at moszumanska.debian.org
Sun Jun 14 22:15:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 5f0daf7b2e196a90257381033e60a1bf045b48eb
Author: onemen <tabmix.onemen at gmail.com>
Date: Wed Jun 10 16:55:21 2015 +0300
Pass AMO validation test for possible attempt to override new tab page
---
chrome/content/links/removeBlankTab.js | 3 ++-
chrome/content/links/setup.js | 4 ++--
chrome/content/links/userInterface.js | 6 +++---
chrome/content/minit/tablib.js | 8 ++++----
chrome/content/places/places.js | 2 +-
chrome/content/preferences/events.js | 2 +-
chrome/content/session/sessionStore.js | 2 +-
chrome/content/tab/tab.js | 2 +-
chrome/content/tabmix.js | 2 +-
modules/Services.jsm | 2 ++
10 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/chrome/content/links/removeBlankTab.js b/chrome/content/links/removeBlankTab.js
index 47b422c..96673af 100644
--- a/chrome/content/links/removeBlankTab.js
+++ b/chrome/content/links/removeBlankTab.js
@@ -39,7 +39,8 @@ let TabmixRemoveBlankTab = {
* The nsIInterfaceRequestor of the parent window; may be null
*/
let {win, b} = this.getWindowAndBrowser(window.arguments[9]);
- if (b && b.currentURI.spec == "about:blank") {
+ let blank = "about:blank";
+ if (b && b.currentURI.spec == blank) {
let uri = window.arguments[8].QueryInterface(Ci.nsIURI);
if (b.userTypedValue == uri.spec) {
let tab = win.gBrowser.getTabForBrowser(b);
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index e0072b8..bde2c9d 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -162,7 +162,7 @@ Tabmix.beforeBrowserInitOnLoad = function() {
' gBrowser.tabs[i].loadOnStartup = true;' +
' }' +
' }' +
- ' if (uriToLoad == "about:blank" || "tabmixdata" in window) {' +
+ ' if (uriToLoad == TabmixSvc.aboutNewtab || "tabmixdata" in window) {' +
' gBrowser.selectedBrowser.stop();' +
' }\n' +
' $&';
@@ -261,7 +261,7 @@ Tabmix.beforeStartup = function TMP_beforeStartup(tabBrowser, aTabContainer) {
return true;
if (aBrowser.canGoForward || aBrowser.canGoBack)
return false;
- return aboutBlank ? aBrowser.currentURI.spec == "about:blank" :
+ return aboutBlank ? aBrowser.currentURI.spec == TabmixSvc.aboutNewtab :
Tabmix.isNewTabUrls(aBrowser.currentURI.spec);
} catch (ex) {Tabmix.assert(ex); return true;}
};
diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 408b74a..56d8c1f 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -71,7 +71,7 @@ Tabmix.openURL = function TMP_openURL(aURL, event) {
var originCharset = tabBrowser.selectedBrowser.characterSet;
// if the current tab is empty, then do not open a new tab
- if (tabBrowser.currentURI.spec == "about:blank") {
+ if (tabBrowser.currentURI.spec == TabmixSvc.aboutBlank) {
// 1: CURRENT_TAB
linkTarget = 1;
originCharset = null;
@@ -126,7 +126,7 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
TabmixSvc.newtabUrl;
try {
url = Services.prefs.getComplexValue(prefName, Ci.nsISupportsString).data;
- if (newTabUrl == "about:privatebrowsing" && url == "about:newtab")
+ if (newTabUrl == "about:privatebrowsing" && url == TabmixSvc.aboutNewtab)
url = "about:privatebrowsing";
} catch (ex) { Tabmix.assert(ex); }
// use this if we can't find the pref
@@ -191,7 +191,7 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
// focus the address bar on new tab
var clearUrlBar = !replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar") ||
replaceLastTab && Tabmix.prefs.getBoolPref("selectLocationBar.afterLastTabClosed") ||
- url == "about:blank" || url == "about:newtab" || url == "about:privatebrowsing";
+ url == TabmixSvc.aboutBlank || url == TabmixSvc.aboutNewtab || url == "about:privatebrowsing";
if (clearUrlBar)
Tabmix.clearUrlBar(newTab, url, false, replaceLastTab);
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 1ccd2a6..ef71d50 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -87,7 +87,7 @@ var tablib = {
params.allowMixedContent = isFlaged("LOAD_FLAGS_ALLOW_MIXED_CONTENT");
return gBrowser.loadOneTab(uri, params);
}
- browser.tabmix_allowLoad = uri == "about:blank" || !isLockedTab;
+ browser.tabmix_allowLoad = uri == TabmixSvc.aboutBlank || !isLockedTab;
return null;
},
@@ -582,7 +582,7 @@ var tablib = {
.replace("referrer", (Tabmix.isVersion(360) ? "aReferrer" : "referrer"));
_openURI = _openURI._replace(
- 'if (#1 && (!aURI || aURI.spec == "about:blank")) {'.replace("#1", arg),
+ 'if (#1 && (!aURI || aURI.spec == TabmixSvc.aboutBlank)) {'.replace("#1", arg),
'let currentIsBlank = win.gBrowser.isBlankNotBusyTab(win.gBrowser.mCurrentTab); \
$&'
)._replace(
@@ -1656,8 +1656,8 @@ var tablib = {
return;
var tabState = TabmixSvc.JSON.parse(TabmixSvc.ss.getTabState(aTab));
if (!tabState.entries || tabState.entries.length == 1 &&
- (tabState.entries[0].url == "about:blank" ||
- tabState.entries[0].url == "about:newtab") &&
+ (tabState.entries[0].url == TabmixSvc.aboutBlank ||
+ tabState.entries[0].url == TabmixSvc.aboutNewtab) &&
!tabState.userTypedValue)
return;
this.numberOfTabsClosedLast++;
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index e84c3cf..1fcf5c2 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -349,7 +349,7 @@ var TMP_Places = {
let title = this.getTabTitle(aTab, aUrl, aTab.label);
if (title != aTab.label) {
aTab.label = title;
- aTab.crop = title != aUrl || aUrl == "about:blank" ? "end" : "center";
+ aTab.crop = title != aUrl || aUrl == TabmixSvc.aboutBlank ? "end" : "center";
aTab.setAttribute("tabmix_changed_label", title);
gBrowser._tabAttrModified(aTab);
if (aTab.selected)
diff --git a/chrome/content/preferences/events.js b/chrome/content/preferences/events.js
index 3d331b6..4e38d02 100644
--- a/chrome/content/preferences/events.js
+++ b/chrome/content/preferences/events.js
@@ -85,7 +85,7 @@ var gEventsPane = {
// If the pref is set to the default, set the value to ""
// to show the placeholder text
let value = preference.value;
- if (value && value.toLowerCase() == "about:newtab")
+ if (value && value.toLowerCase() == TabmixSvc.aboutNewtab)
return "";
return this.syncToNewTabUrlPref(value);
},
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index 3694025..c3a65a6 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -36,7 +36,7 @@ var TMP_SessionStore = { // jshint ignore:line
aUndoItem.title = selectedTab.attributes["fixed-label"];
else {
aUndoItem.title = TMP_Places.getTitleFromBookmark(tabData.url, aUndoItem.title || tabData.title || tabData.url);
- if (aUndoItem.title == "about:blank")
+ if (aUndoItem.title == TabmixSvc.aboutBlank)
aUndoItem.title = gBrowser.mStringBundle.getString("tabs.emptyTabTitle");
}
},
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 96a2fe8..22114a6 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -2535,7 +2535,7 @@ var TabmixProgressListener = {
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
let url = aRequest.QueryInterface(Ci.nsIChannel).URI.spec;
this._fixTabTitle(tab, aBrowser, url);
- if (url == "about:blank") {
+ if (url == TabmixSvc.aboutBlank) {
tab.removeAttribute("busy");
tab.removeAttribute("progress");
this.mTabBrowser.setTabTitle(tab);
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 0cc4c26..7f3397a 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -660,7 +660,7 @@ var TMP_eventListener = {
// don't mark new tab as unread
var url = tab.linkedBrowser.currentURI.spec;
- if (url == "about:blank" || url == "about:newtab")
+ if (url == TabmixSvc.aboutBlank || url == TabmixSvc.aboutNewtab)
tab.setAttribute("visited", true);
},
diff --git a/modules/Services.jsm b/modules/Services.jsm
index d831c35..2dfed6e 100644
--- a/modules/Services.jsm
+++ b/modules/Services.jsm
@@ -24,6 +24,8 @@ function isVersion(aVersionNo) {
}
this.TabmixSvc = {
+ aboutBlank: "about:blank",
+ aboutNewtab: "about:newtab",
newtabUrl: "browser" + ".newtab.url",
debugMode: function() {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list