This commit is contained in:
Ryan VanderMeulen 2016-09-01 11:48:45 -04:00
Родитель c6b0a50842 e1afe71af4
Коммит 44f02640c6
41 изменённых файлов: 282 добавлений и 260 удалений

Просмотреть файл

@ -64,10 +64,8 @@ XPCOMUtils.defineLazyServiceGetter(Services, 'captivePortalDetector',
'@mozilla.org/toolkit/captive-detector;1',
'nsICaptivePortalDetector');
if (AppConstants.MOZ_SAFE_BROWSING) {
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
}
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SafeMode",
"resource://gre/modules/SafeMode.jsm");
@ -434,11 +432,9 @@ var shell = {
ppmm.addMessageListener("mail-handler", this);
ppmm.addMessageListener("file-picker", this);
if (AppConstants.MOZ_SAFE_BROWSING) {
setTimeout(function() {
SafeBrowsing.init();
}, 5000);
}
setTimeout(function() {
SafeBrowsing.init();
}, 5000);
},
stop: function shell_stop() {

Просмотреть файл

@ -17,8 +17,6 @@ MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
# MOZ_APP_DISPLAYNAME is set by branding/configure.sh
MOZ_SAFE_BROWSING=1
MOZ_NO_SMART_CARDS=1
MOZ_APP_STATIC_INI=1
MOZ_NO_EV_CERTS=1

Просмотреть файл

@ -24,7 +24,6 @@ MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
# MOZ_APP_DISPLAYNAME is set by branding/configure.sh
MOZ_SAFE_BROWSING=1
MOZ_CAPTIVEDETECT=1
MOZ_NO_SMART_CARDS=1

Просмотреть файл

@ -13,10 +13,8 @@
%customizeToolbarDTD;
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
#ifdef MOZ_SAFE_BROWSING
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
%safebrowsingDTD;
#endif
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD;
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Note: this file is not shipped (through jar.mn)
// if MOZ_SAFE_BROWSING is not defined.
var gSafeBrowsing = {
setReportPhishingMenu: function() {

Просмотреть файл

@ -763,7 +763,7 @@ html|*#fullscreen-exit-button {
-moz-user-focus: normal;
}
.blocked-permission-icon:not([showing]),
#blocked-permissions-container > .blocked-permission-icon:not([showing]),
.notification-anchor-icon:not([showing]) {
display: none;
}

Просмотреть файл

@ -57,10 +57,8 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["webrtcUI", "resource:///modules/webrtcUI.jsm", ]
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
if (AppConstants.MOZ_SAFE_BROWSING) {
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
}
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
@ -1146,10 +1144,8 @@ var gBrowserInit = {
}
}
if (AppConstants.MOZ_SAFE_BROWSING) {
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
setTimeout(function() { SafeBrowsing.init(); }, 2000);
}
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
setTimeout(function() { SafeBrowsing.init(); }, 2000);
Services.obs.addObserver(gIdentityHandler, "perm-changed", false);
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
@ -7377,7 +7373,7 @@ var gIdentityHandler = {
let img = document.createElement("image");
let classes = "identity-popup-permission-icon " + aPermission.id + "-icon";
if (aPermission.state == SitePermissions.BLOCK)
classes += " blocked";
classes += " blocked-permission-icon";
if (aPermission.inUse)
classes += " in-use";
img.setAttribute("class", classes);

Просмотреть файл

@ -23,9 +23,7 @@
<script type="application/javascript" src="chrome://browser/content/browser-places.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-plugins.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-refreshblocker.js"/>
#ifdef MOZ_SAFE_BROWSING
<script type="application/javascript" src="chrome://browser/content/browser-safebrowsing.js"/>
#endif
<script type="application/javascript" src="chrome://browser/content/browser-sidebar.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-social.js"/>
<script type="application/javascript" src="chrome://browser/content/browser-syncui.js"/>

Просмотреть файл

@ -742,8 +742,9 @@ function openTourPage()
function buildHelpMenu()
{
// Enable/disable the "Report Web Forgery" menu item.
if (typeof gSafeBrowsing != "undefined" && AppConstants.MOZ_SAFE_BROWSING)
if (typeof gSafeBrowsing != "undefined") {
gSafeBrowsing.setReportPhishingMenu();
}
}
function isElementVisible(aElement)

Просмотреть файл

@ -87,9 +87,7 @@ browser.jar:
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-plugins.js (content/browser-plugins.js)
content/browser/browser-refreshblocker.js (content/browser-refreshblocker.js)
#ifdef MOZ_SAFE_BROWSING
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
#endif
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-social.js (content/browser-social.js)
content/browser/browser-syncui.js (content/browser-syncui.js)
@ -191,10 +189,8 @@ browser.jar:
# the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html
#ifdef MOZ_SAFE_BROWSING
content/browser/report-phishing-overlay.xul (content/report-phishing-overlay.xul)
content/browser/blockedSite.xhtml (content/blockedSite.xhtml)
% overlay chrome://browser/content/browser.xul chrome://browser/content/report-phishing-overlay.xul
#endif
% override chrome://global/content/netError.xhtml chrome://browser/content/aboutNetError.xhtml

Просмотреть файл

@ -35,13 +35,11 @@ struct RedirEntry {
URI_SAFE_FOR_UNTRUSTED_CONTENT.
*/
static RedirEntry kRedirMap[] = {
#ifdef MOZ_SAFE_BROWSING
{ "blocked", "chrome://browser/content/blockedSite.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
#endif
{ "certerror", "chrome://browser/content/aboutNetError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |

Просмотреть файл

@ -85,9 +85,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
#ifdef MOZ_SAFE_BROWSING
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "providerdirectory", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },

Просмотреть файл

@ -50,6 +50,7 @@ EXTRA_JS_MODULES += [
]
BROWSER_CHROME_MANIFESTS += [
'safebrowsing/content/test/browser.ini',
'tests/browser/browser.ini'
]
@ -57,9 +58,6 @@ XPCSHELL_TESTS_MANIFESTS += [
'tests/unit/xpcshell.ini'
]
if CONFIG['MOZ_SAFE_BROWSING']:
BROWSER_CHROME_MANIFESTS += ['safebrowsing/content/test/browser.ini']
with Files('safebrowsing/*'):
BUG_COMPONENT = ('Toolkit', 'Phishing Protection')

Просмотреть файл

@ -32,7 +32,6 @@ fi
# Enable building ./signmar and running libmar signature tests
MOZ_ENABLE_SIGNMAR=1
MOZ_SAFE_BROWSING=1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_APP_VERSION_DISPLAY=$FIREFOX_VERSION_DISPLAY
MOZ_EXTENSIONS_DEFAULT=" gio"

Просмотреть файл

@ -596,13 +596,11 @@
@RESPATH@/modules/*
; Safe Browsing
#ifdef MOZ_URL_CLASSIFIER
@RESPATH@/components/nsURLClassifier.manifest
@RESPATH@/components/nsUrlClassifierHashCompleter.js
@RESPATH@/components/nsUrlClassifierListManager.js
@RESPATH@/components/nsUrlClassifierLib.js
@RESPATH@/components/url-classifier.xpt
#endif
; Private Browsing
@RESPATH@/components/privatebrowsing.xpt

Просмотреть файл

@ -53,10 +53,8 @@
locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd)
locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd)
#ifdef MOZ_SAFE_BROWSING
locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd)
locale/browser/safebrowsing/report-phishing.dtd (%chrome/browser/safebrowsing/report-phishing.dtd)
#endif
locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd)
locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties)
locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd)

Просмотреть файл

@ -13,4 +13,7 @@ DevToolsModules(
'panel.js'
)
BROWSER_CHROME_MANIFESTS += ['test/mochitest/browser.ini']
BROWSER_CHROME_MANIFESTS += [
'new/test/mochitest/browser.ini',
'test/mochitest/browser.ini'
]

Просмотреть файл

@ -0,0 +1,5 @@
[DEFAULT]
tags = devtools
subsuite = devtools
[browser_dbg_stub.js]

Просмотреть файл

@ -0,0 +1,7 @@
add_task(function*() {
ok(true,
"This is a stub so that we can run the new debugger tests " +
"by copying them in here. This will go away once we land " +
"the initial suite of new tests");
});

Просмотреть файл

@ -182,14 +182,28 @@ Tools.jsdebugger = {
}
};
if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
const NewDebuggerPanel = require("devtools/client/debugger/new/panel").DebuggerPanel;
function switchDebugger() {
if (Services.prefs.getBoolPref("devtools.debugger.new-debugger-frontend")) {
const NewDebuggerPanel = require("devtools/client/debugger/new/panel").DebuggerPanel;
Tools.jsdebugger.url = "chrome://devtools/content/debugger/new/index.html";
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
return new NewDebuggerPanel(iframeWindow, toolbox);
};
Tools.jsdebugger.url = "chrome://devtools/content/debugger/new/index.html";
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
return new NewDebuggerPanel(iframeWindow, toolbox);
};
} else {
Tools.jsdebugger.url = "chrome://devtools/content/debugger/debugger.xul";
Tools.jsdebugger.build = function (iframeWindow, toolbox) {
return new DebuggerPanel(iframeWindow, toolbox);
};
}
}
switchDebugger();
Services.prefs.addObserver(
"devtools.debugger.new-debugger-frontend",
{ observe: switchDebugger },
false
);
Tools.styleEditor = {
id: "styleeditor",

Просмотреть файл

@ -6,6 +6,24 @@
const parsePropertiesFile = require("devtools/shared/node-properties/node-properties");
const { sprintf } = require("devtools/shared/sprintfjs/sprintf");
const propertiesMap = {};
/**
* Memoized getter for properties files that ensures a given url is only required and
* parsed once.
*
* @param {String} url
* The URL of the properties file to parse.
* @return {Object} parsed properties mapped in an object.
*/
function getProperties(url) {
if (!propertiesMap[url]) {
propertiesMap[url] = parsePropertiesFile(require(`raw!${url}`));
}
return propertiesMap[url];
}
/**
* Localization convenience methods.
*
@ -17,14 +35,6 @@ function LocalizationHelper(stringBundleName) {
}
LocalizationHelper.prototype = {
get properties() {
if (!this._properties) {
this._properties = parsePropertiesFile(require(`raw!${this.stringBundleName}`));
}
return this._properties;
},
/**
* L10N shortcut function.
*
@ -32,8 +42,9 @@ LocalizationHelper.prototype = {
* @return string
*/
getStr: function (name) {
if (name in this.properties) {
return this.properties[name];
let properties = getProperties(this.stringBundleName);
if (name in properties) {
return properties[name];
}
throw new Error("No localization found for [" + name + "]");
@ -103,6 +114,63 @@ LocalizationHelper.prototype = {
}
};
function getPropertiesForNode(node) {
let bundleEl = node.closest("[data-localization-bundle]");
if (!bundleEl) {
return null;
}
let propertiesUrl = bundleEl.getAttribute("data-localization-bundle");
return getProperties(propertiesUrl);
}
/**
* Translate existing markup annotated with data-localization attributes.
*
* How to use data-localization in markup:
*
* <div data-localization="content=myContent;title=myTitle"/>
*
* The data-localization attribute identifies an element as being localizable.
* The content of the attribute is semi-colon separated list of descriptors.
* - "title=myTitle" means the "title" attribute should be replaced with the localized
* string corresponding to the key "myTitle".
* - "content=myContent" means the text content of the node should be replaced by the
* string corresponding to "myContent"
*
* How to define the localization bundle in markup:
*
* <div data-localization-bundle="url/to/my.properties">
* [...]
* <div data-localization="content=myContent;title=myTitle"/>
*
* Set the data-localization-bundle on an ancestor of the nodes that should be localized.
*
* @param {Element} root
* The root node to use for the localization
*/
function localizeMarkup(root) {
let elements = root.querySelectorAll("[data-localization]");
for (let element of elements) {
let properties = getPropertiesForNode(element);
if (!properties) {
continue;
}
let attributes = element.getAttribute("data-localization").split(";");
for (let attribute of attributes) {
let [name, value] = attribute.trim().split("=");
if (name === "content") {
element.textContent = properties[value];
} else {
element.setAttribute(name, properties[value]);
}
}
element.removeAttribute("data-localization");
}
}
const sharedL10N = new LocalizationHelper("devtools-shared/locale/shared.properties");
const ELLIPSIS = sharedL10N.getStr("ellipsis");
@ -140,5 +208,6 @@ function MultiLocalizationHelper(...stringBundleNames) {
}
exports.LocalizationHelper = LocalizationHelper;
exports.localizeMarkup = localizeMarkup;
exports.MultiLocalizationHelper = MultiLocalizationHelper;
exports.ELLIPSIS = ELLIPSIS;

Просмотреть файл

@ -5,3 +5,4 @@ support-files =
../../../server/tests/browser/head.js
[browser_async_storage.js]
[browser_l10n_localizeMarkup.js]

Просмотреть файл

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that the markup localization works properly.
const { localizeMarkup, LocalizationHelper } = require("devtools/shared/l10n");
add_task(function* () {
info("Check that the strings used for this test are still valid");
let INSPECTOR_L10N = new LocalizationHelper("devtools/locale/inspector.properties");
let TOOLBOX_L10N = new LocalizationHelper("devtools/locale/toolbox.properties");
let str1 = INSPECTOR_L10N.getStr("inspector.label");
let str2 = INSPECTOR_L10N.getStr("inspector.commandkey");
let str3 = TOOLBOX_L10N.getStr("toolbox.defaultTitle");
ok(str1 && str2 && str3, "If this failed, strings should be updated in the test");
info("Create the test markup");
let div = document.createElement("div");
div.innerHTML =
`<div data-localization-bundle="devtools/locale/inspector.properties">
<div id="d0" data-localization="content=inspector.someInvalidKey"></div>
<div id="d1" data-localization="content=inspector.label">Text will disappear</div>
<div id="d2" data-localization="content=inspector.label;title=inspector.commandkey">
</div>
<!-- keep the following data-localization on two separate lines -->
<div id="d3" data-localization="content=inspector.label;
title=inspector.commandkey"></div>
<div id="d4" data-localization="aria-label=inspector.label">Some content</div>
<div data-localization-bundle="devtools/locale/toolbox.properties">
<div id="d5" data-localization="content=toolbox.defaultTitle"></div>
</div>
</div>
`;
info("Use localization helper to localize the test markup");
localizeMarkup(div);
let div1 = div.querySelector("#d1");
let div2 = div.querySelector("#d2");
let div3 = div.querySelector("#d3");
let div4 = div.querySelector("#d4");
let div5 = div.querySelector("#d5");
is(div1.innerHTML, str1, "The content of #d1 is localized");
is(div2.innerHTML, str1, "The content of #d2 is localized");
is(div2.getAttribute("title"), str2, "The title of #d2 is localized");
is(div3.innerHTML, str1, "The content of #d3 is localized");
is(div3.getAttribute("title"), str2, "The title of #d3 is localized");
is(div4.innerHTML, "Some content", "The content of #d4 is not replaced");
is(div4.getAttribute("aria-label"), str1, "The aria-label of #d4 is localized");
is(div5.innerHTML, str3, "The content of #d5 is localized with another bundle");
});

Просмотреть файл

@ -2554,7 +2554,7 @@ TabParent::GetAuthPrompt(uint32_t aPromptReason, const nsIID& iid,
nsCOMPtr<nsILoginManagerPrompter> prompter = do_QueryInterface(prompt);
if (prompter) {
nsCOMPtr<nsIDOMElement> browser = do_QueryInterface(mFrameElement);
prompter->SetE10sData(browser, nullptr);
prompter->SetBrowser(browser);
}
*aResult = prompt.forget().take();

Просмотреть файл

@ -57,10 +57,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerParent",
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
if (AppConstants.MOZ_SAFE_BROWSING) {
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
}
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
@ -549,10 +547,8 @@ var BrowserApp = {
InitLater(() => Services.search.init(), Services, "search");
InitLater(() => DownloadNotifications.init(), window, "DownloadNotifications");
if (AppConstants.MOZ_SAFE_BROWSING) {
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
InitLater(() => SafeBrowsing.init(), window, "SafeBrowsing");
}
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
InitLater(() => SafeBrowsing.init(), window, "SafeBrowsing");
InitLater(() => Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager));
InitLater(() => LoginManagerParent.init(), window, "LoginManagerParent");

Просмотреть файл

@ -105,18 +105,23 @@ LoginManagerPrompter.prototype = {
*
*/
init : function (aWindow, aFactory) {
this._window = aWindow;
this._chromeWindow = this._getChromeWindow(aWindow).wrappedJSObject;
this._factory = aFactory || null;
this._browser = null;
var prefBranch = Services.prefs.getBranch("signon.");
this._debug = prefBranch.getBoolPref("debug");
this.log("===== initialized =====");
},
setE10sData : function (aBrowser, aOpener) {
throw new Error("This should be filled in when Android is multiprocess");
set browser(aBrowser) {
this._browser = aBrowser;
},
// setting this attribute is ignored because Android does not consider
// opener windows when displaying login notifications
set opener(aOpener) { },
/*
* promptToSavePassword
*
@ -140,10 +145,7 @@ LoginManagerPrompter.prototype = {
* Password string used in creating a doorhanger action
*/
_showLoginNotification : function (aBody, aButtons, aUsername, aPassword) {
let notifyWin = this._window.top;
let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
let browser = chromeWin.BrowserApp.getBrowserForWindow(notifyWin);
let tabID = chromeWin.BrowserApp.getTabForBrowser(browser).id;
let tabID = this._chromeWindow.BrowserApp.getTabForBrowser(this._browser).id;
let actionText = {
text: aUsername,
@ -334,6 +336,8 @@ LoginManagerPrompter.prototype = {
* Given a content DOM window, returns the chrome window it's in.
*/
_getChromeWindow: function (aWindow) {
if (aWindow instanceof Ci.nsIDOMChromeWindow)
return aWindow;
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
@ -350,8 +354,7 @@ LoginManagerPrompter.prototype = {
_getNativeWindow : function () {
let nativeWindow = null;
try {
let notifyWin = this._window.top;
let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
let chromeWin = this._chromeWindow;
if (chromeWin.NativeWindow) {
nativeWindow = chromeWin.NativeWindow;
} else {

Просмотреть файл

@ -14,9 +14,7 @@ contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {322ba47e-70
#ifdef MOZ_SERVICES_HEALTHREPORT
contract @mozilla.org/network/protocol/about;1?what=healthreport {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#endif
#ifdef MOZ_SAFE_BROWSING
contract @mozilla.org/network/protocol/about;1?what=blocked {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#endif
contract @mozilla.org/network/protocol/about;1?what=accounts {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=logins {322ba47e-7047-4f71-aebf-cb7d69325cd9}

Просмотреть файл

@ -23,8 +23,6 @@ MOZ_ANDROID_APPLICATION_CLASS=org.mozilla.gecko.GeckoApplication
MOZ_ANDROID_BROWSER_INTENT_CLASS=org.mozilla.gecko.BrowserApp
MOZ_ANDROID_SEARCH_INTENT_CLASS=org.mozilla.search.SearchActivity
MOZ_SAFE_BROWSING=1
MOZ_NO_SMART_CARDS=1
MOZ_XULRUNNER=

Просмотреть файл

@ -431,14 +431,12 @@
; Modules
@BINPATH@/modules/*
#ifdef MOZ_SAFE_BROWSING
; Safe Browsing
@BINPATH@/components/nsURLClassifier.manifest
@BINPATH@/components/nsUrlClassifierHashCompleter.js
@BINPATH@/components/nsUrlClassifierListManager.js
@BINPATH@/components/nsUrlClassifierLib.js
@BINPATH@/components/url-classifier.xpt
#endif
; Private Browsing
@BINPATH@/components/privatebrowsing.xpt

Просмотреть файл

@ -2339,7 +2339,6 @@ LIBJPEG_TURBO_AS=
LIBJPEG_TURBO_ASFLAGS=
MOZ_PREF_EXTENSIONS=1
MOZ_REFLOW_PERF=
MOZ_SAFE_BROWSING=
MOZ_SPELLCHECK=1
MOZ_TOOLKIT_SEARCH=1
MOZ_UI_LOCALE=en-US
@ -4304,25 +4303,9 @@ if test -n "$MOZ_SYSTEM_SQLITE"; then
fi
AC_SUBST(MOZ_SYSTEM_SQLITE)
dnl ========================================================
dnl = Enable safe browsing (anti-phishing)
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(safe-browsing,
[ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
MOZ_SAFE_BROWSING=1,
MOZ_SAFE_BROWSING= )
if test -n "$MOZ_SAFE_BROWSING"; then
AC_DEFINE(MOZ_SAFE_BROWSING)
fi
AC_SUBST(MOZ_SAFE_BROWSING)
dnl ========================================================
dnl = Enable url-classifier
dnl ========================================================
dnl Implicitly enabled by default if building with safe-browsing
if test -n "$MOZ_SAFE_BROWSING"; then
MOZ_URL_CLASSIFIER=1
fi
MOZ_ARG_ENABLE_BOOL(url-classifier,
[ --enable-url-classifier Enable url classifier module],
MOZ_URL_CLASSIFIER=1,

Просмотреть файл

@ -26,13 +26,11 @@
#include "nsTypeAheadFind.h"
#ifdef MOZ_URL_CLASSIFIER
#include "ApplicationReputation.h"
#include "nsUrlClassifierDBService.h"
#include "nsUrlClassifierStreamUpdater.h"
#include "nsUrlClassifierUtils.h"
#include "nsUrlClassifierPrefixSet.h"
#endif
#include "nsBrowserStatusFilter.h"
#include "mozilla/FinalizationWitnessService.h"
@ -91,7 +89,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind)
#ifdef MOZ_URL_CLASSIFIER
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService,
ApplicationReputationService::GetSingleton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet)
@ -116,7 +113,6 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter)
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
@ -148,13 +144,11 @@ NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID);
NS_DEFINE_NAMED_CID(NS_DOWNLOAD_CID);
NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID);
#ifdef MOZ_URL_CLASSIFIER
NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERUTILS_CID);
#endif
NS_DEFINE_NAMED_CID(NS_BROWSERSTATUSFILTER_CID);
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
@ -184,13 +178,11 @@ static const Module::CIDEntry kToolkitCIDs[] = {
{ &kNS_DOWNLOAD_CID, false, nullptr, nsDownloadProxyConstructor },
{ &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor },
{ &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor },
#ifdef MOZ_URL_CLASSIFIER
{ &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor },
{ &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor },
{ &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor },
{ &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor },
{ &kNS_URLCLASSIFIERUTILS_CID, false, nullptr, nsUrlClassifierUtilsConstructor },
#endif
{ &kNS_BROWSERSTATUSFILTER_CID, false, nullptr, nsBrowserStatusFilterConstructor },
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{ &kNS_UPDATEPROCESSOR_CID, false, nullptr, nsUpdateProcessorConstructor },
@ -221,14 +213,12 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
{ NS_DOWNLOADPLATFORM_CONTRACTID, &kNS_DOWNLOADPLATFORM_CID },
{ NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID },
{ NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID },
#ifdef MOZ_URL_CLASSIFIER
{ NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID },
{ NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID },
{ NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
{ NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
{ NS_URLCLASSIFIERSTREAMUPDATER_CONTRACTID, &kNS_URLCLASSIFIERSTREAMUPDATER_CID },
{ NS_URLCLASSIFIERUTILS_CONTRACTID, &kNS_URLCLASSIFIERUTILS_CID },
#endif
{ NS_BROWSERSTATUSFILTER_CONTRACTID, &kNS_BROWSERSTATUSFILTER_CID },
#if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID)
{ NS_UPDATEPROCESSOR_CONTRACTID, &kNS_UPDATEPROCESSOR_CID },

Просмотреть файл

@ -32,7 +32,9 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'downloads'
UNIFIED_SOURCES += [
'nsDownloadManager.cpp',
'ApplicationReputation.cpp',
'chromium/chrome/common/safe_browsing/csd.pb.cc',
'nsDownloadManager.cpp'
]
# SQLFunctions.cpp cannot be built in unified mode because of Windows headers.
@ -40,12 +42,6 @@ SOURCES += [
'SQLFunctions.cpp',
]
if CONFIG['MOZ_URL_CLASSIFIER']:
UNIFIED_SOURCES += [
'ApplicationReputation.cpp',
'chromium/chrome/common/safe_browsing/csd.pb.cc'
]
if CONFIG['OS_ARCH'] == 'WINNT':
# Can't build unified because we need CreateEvent which some IPC code
# included in LoadContext ends up undefining.

Просмотреть файл

@ -521,12 +521,6 @@ this.DownloadIntegration = {
* }
*/
shouldBlockForReputationCheck(aDownload) {
#ifndef MOZ_URL_CLASSIFIER
return Promise.resolve({
shouldBlock: false,
verdict: "",
});
#else
let hash;
let sigInfo;
let channelRedirects;
@ -567,7 +561,6 @@ this.DownloadIntegration = {
});
});
return deferred.promise;
#endif
},
#ifdef XP_WIN

Просмотреть файл

@ -60,6 +60,7 @@ DIRS += [
'tooltiptext',
'typeaheadfind',
'utils',
'url-classifier',
'urlformatter',
'viewconfig',
'workerloader',
@ -87,9 +88,6 @@ if CONFIG['MOZ_XUL']:
if CONFIG['MOZ_TOOLKIT_SEARCH']:
DIRS += ['search']
if CONFIG['MOZ_URL_CLASSIFIER']:
DIRS += ['url-classifier']
DIRS += ['captivedetect']
if CONFIG['OS_TARGET'] != 'Android':

Просмотреть файл

@ -918,7 +918,7 @@ var LoginManagerContent = {
null;
// Make sure to pass the opener's top in case it was in a frame.
let opener = win.opener ? win.opener.top : null;
let openerTopWindow = win.opener ? win.opener.top : null;
messageManager.sendAsyncMessage("RemoteLogins:onFormSubmit",
{ hostname: hostname,
@ -926,7 +926,7 @@ var LoginManagerContent = {
usernameField: mockUsername,
newPasswordField: mockPassword,
oldPasswordField: mockOldPassword },
{ openerWin: opener });
{ openerTopWindow });
},
/**

Просмотреть файл

@ -84,7 +84,7 @@ var LoginManagerParent = {
data.usernameField,
data.newPasswordField,
data.oldPasswordField,
msg.objects.openerWin,
msg.objects.openerTopWindow,
msg.target);
break;
}
@ -287,21 +287,14 @@ var LoginManagerParent = {
onFormSubmit: function(hostname, formSubmitURL,
usernameField, newPasswordField,
oldPasswordField, opener,
oldPasswordField, openerTopWindow,
target) {
function getPrompter() {
var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
createInstance(Ci.nsILoginManagerPrompter);
// XXX For E10S, we don't want to use the browser's contentWindow
// because it's in another process, so we use our chrome window as
// the window parent (the content process is responsible for
// making sure that its window is not in private browsing mode).
// In the same-process case, we can simply use the content window.
prompterSvc.init(target.isRemoteBrowser ?
target.ownerDocument.defaultView :
target.contentWindow);
if (target.isRemoteBrowser)
prompterSvc.setE10sData(target, opener);
prompterSvc.init(target.ownerDocument.defaultView);
prompterSvc.browser = target;
prompterSvc.opener = openerTopWindow;
return prompterSvc;
}

Просмотреть файл

@ -19,18 +19,26 @@ interface nsILoginManagerPrompter : nsISupports {
* resulting in a need to prompt them for something. The prompt
* will be associated with this window (or, if a notification bar
* is being used, topmost opener in some cases).
*
* If this window is a content window, the corresponding window and browser
* elements will be calculated. If this window is a chrome window, the
* corresponding browser element needs to be set using setBrowser.
*/
void init(in nsIDOMWindow aWindow);
/**
* If the caller knows which browser this prompter is being created for,
* they can call this function to avoid having to calculate it from the
* window passed to init.
*
* @param aBrowser the <browser> to use for this prompter.
* @param aOpener the opener to use for this prompter.
* The browser this prompter is being created for.
* This is required if the init function received a chrome window as argument.
*/
void setE10sData(in nsIDOMElement aBrowser, in nsIDOMWindow aOpener);
attribute nsIDOMElement browser;
/**
* The opener that was used to open the window passed to init.
* The opener can be used to determine in which window the prompt
* should be shown. Must be a content window that is not a frame window,
* make sure to pass the top window using e.g. window.top.
*/
attribute nsIDOMWindow opener;
/**
* Ask the user if they want to save a login (Yes, Never, Not Now)

Просмотреть файл

@ -257,8 +257,8 @@ LoginManagerPrompter.prototype = {
// Whether we are in private browsing mode
get _inPrivateBrowsing() {
if (this._window) {
return PrivateBrowsingUtils.isContentWindowPrivate(this._window);
if (this._chromeWindow) {
return PrivateBrowsingUtils.isWindowPrivate(this._chromeWindow);
}
// If we don't that we're in private browsing mode if the caller did
// not provide a window. The callers which really care about this
@ -290,7 +290,7 @@ LoginManagerPrompter.prototype = {
aResult.value = aDefaultText;
}
return this._promptService.prompt(this._window,
return this._promptService.prompt(this._chromeWindow,
aDialogTitle, aText, aResult, null, {});
},
@ -352,7 +352,7 @@ LoginManagerPrompter.prototype = {
}
}
var ok = this._promptService.promptUsernameAndPassword(this._window,
var ok = this._promptService.promptUsernameAndPassword(this._chromeWindow,
aDialogTitle, aText, aUsername, aPassword,
checkBoxLabel, checkBox);
@ -443,7 +443,7 @@ LoginManagerPrompter.prototype = {
}
}
var ok = this._promptService.promptPassword(this._window, aDialogTitle,
var ok = this._promptService.promptPassword(this._chromeWindow, aDialogTitle,
aText, aPassword,
checkBoxLabel, checkBox);
@ -563,9 +563,9 @@ LoginManagerPrompter.prototype = {
var ok = canAutologin;
if (!ok) {
if (this._window)
PromptUtils.fireDialogEvent(this._window, "DOMWillOpenModalDialog", this._browser);
ok = this._promptService.promptAuth(this._window,
if (this._chromeWindow)
PromptUtils.fireDialogEvent(this._chromeWindow, "DOMWillOpenModalDialog", this._browser);
ok = this._promptService.promptAuth(this._chromeWindow,
aChannel, aLevel, aAuthInfo,
checkboxLabel, checkbox);
}
@ -679,20 +679,27 @@ LoginManagerPrompter.prototype = {
/* ---------- nsILoginManagerPrompter prompts ---------- */
init : function (aWindow, aFactory) {
this._window = aWindow;
this._factory = aFactory || null;
this._browser = null;
if (aWindow instanceof Ci.nsIDOMChromeWindow) {
this._chromeWindow = aWindow;
// needs to be set explicitly using setBrowser
this._browser = null;
} else {
let {win, browser} = this._getChromeWindow(aWindow);
this._chromeWindow = win;
this._browser = browser;
}
this._opener = null;
this._factory = aFactory || null;
this.log("===== initialized =====");
},
setE10sData : function (aBrowser, aOpener) {
if (!(this._window instanceof Ci.nsIDOMChromeWindow))
throw new Error("Unexpected call");
set browser(aBrowser) {
this._browser = aBrowser;
},
set opener(aOpener) {
this._opener = aOpener;
},
@ -1121,7 +1128,7 @@ LoginManagerPrompter.prototype = {
"notNowButtonText");
this.log("Prompting user to save/ignore login");
var userChoice = this._promptService.confirmEx(this._window,
var userChoice = this._promptService.confirmEx(this._chromeWindow,
dialogTitle, dialogText,
buttonFlags, rememberButtonText,
notNowButtonText, neverButtonText,
@ -1253,7 +1260,7 @@ LoginManagerPrompter.prototype = {
"passwordChangeTitle");
// returns 0 for yes, 1 for no.
var ok = !this._promptService.confirmEx(this._window,
var ok = !this._promptService.confirmEx(this._chromeWindow,
dialogTitle, dialogText, buttonFlags,
null, null, null,
null, {});
@ -1286,7 +1293,7 @@ LoginManagerPrompter.prototype = {
// If user selects ok, outparam.value is set to the index
// of the selected username.
var ok = this._promptService.select(this._window,
var ok = this._promptService.select(this._chromeWindow,
dialogTitle, dialogText,
usernames.length, usernames,
selectedIndex);
@ -1331,86 +1338,40 @@ LoginManagerPrompter.prototype = {
this._pwmgr.modifyLogin(login, propBag);
},
/**
* Given a content DOM window, returns the chrome window it's in.
* Given a content DOM window, returns the chrome window and browser it's in.
*/
_getChromeWindow: function (aWindow) {
// In e10s, aWindow may already be a chrome window.
if (aWindow instanceof Ci.nsIDOMChromeWindow)
return aWindow;
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
return chromeWin;
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
let win = windows.getNext();
let browser = win.gBrowser.getBrowserForContentWindow(aWindow);
if (browser) {
return { win, browser };
}
}
return null;
},
_getNotifyWindow: function () {
// Some sites pop up a temporary login window, which disappears
// upon submission of credentials. We want to put the notification
// bar in the opener window if this seems to be happening.
if (this._opener) {
let chromeDoc = this._chromeWindow.document.documentElement;
try {
// Get topmost window, in case we're in a frame.
var notifyWin = this._window.top;
var isE10s = (notifyWin instanceof Ci.nsIDOMChromeWindow);
var useOpener = false;
// Some sites pop up a temporary login window, which disappears
// upon submission of credentials. We want to put the notification
// bar in the opener window if this seems to be happening.
if (notifyWin.opener) {
var chromeDoc = this._getChromeWindow(notifyWin).
document.documentElement;
var hasHistory;
if (isE10s) {
if (!this._browser)
throw new Error("Expected a browser in e10s");
hasHistory = this._browser.canGoBack;
} else {
var webnav = notifyWin.
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation);
hasHistory = webnav.sessionHistory.count > 1;
}
// Check to see if the current window was opened with chrome
// disabled, and if so use the opener window. But if the window
// has been used to visit other pages (ie, has a history),
// assume it'll stick around and *don't* use the opener.
if (chromeDoc.getAttribute("chromehidden") && !hasHistory) {
this.log("Using opener window for notification bar.");
notifyWin = notifyWin.opener;
useOpener = true;
}
// Check to see if the current window was opened with chrome
// disabled, and if so use the opener window. But if the window
// has been used to visit other pages (ie, has a history),
// assume it'll stick around and *don't* use the opener.
if (chromeDoc.getAttribute("chromehidden") && !this._browser.canGoBack) {
this.log("Using opener window for notification bar.");
return this._getChromeWindow(this._opener);
}
let browser;
if (useOpener && this._opener && isE10s) {
// In e10s, we have to reconstruct the opener browser from
// the CPOW passed in the message (and then passed to us in
// setE10sData).
// NB: notifyWin is now the chrome window for the opening
// window.
browser = notifyWin.gBrowser.getBrowserForContentWindow(this._opener);
} else if (isE10s) {
browser = this._browser;
} else {
var chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
browser = chromeWin.gBrowser
.getBrowserForDocument(notifyWin.top.document);
}
return { notifyWin: notifyWin, browser: browser };
} catch (e) {
// If any errors happen, just assume no notification box.
this.log("Unable to get notify window: " + e.fileName + ":" + e.lineNumber + ": " + e.message);
return null;
}
},
return { win: this._chromeWindow, browser: this._browser };
},
/**
* Returns the popup notification to this prompter,
@ -1420,13 +1381,10 @@ LoginManagerPrompter.prototype = {
let popupNote = null;
try {
let { notifyWin } = this._getNotifyWindow();
let { win: notifyWin } = this._getNotifyWindow();
// Get the chrome window for the content window we're using.
// .wrappedJSObject needed here -- see bug 422974 comment 5.
let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
popupNote = chromeWin.PopupNotifications;
popupNote = notifyWin.wrappedJSObject.PopupNotifications;
} catch (e) {
this.log("Popup notifications not available on window");
}
@ -1443,13 +1401,10 @@ LoginManagerPrompter.prototype = {
let notifyBox = null;
try {
let { notifyWin } = this._getNotifyWindow();
let { win: notifyWin } = this._getNotifyWindow();
// Get the chrome window for the content window we're using.
// .wrappedJSObject needed here -- see bug 422974 comment 5.
let chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
notifyBox = chromeWin.getNotificationBox(notifyWin);
notifyBox = notifyWin.wrappedJSObject.getNotificationBox(notifyWin);
} catch (e) {
this.log("Notification bars not available on window");
}

Просмотреть файл

@ -30,7 +30,6 @@ support-files =
subtst_notifications_10.html
subtst_notifications_change_p.html
[browser_capture_doorhanger_window_open.js]
skip-if = e10s # Bug 1266836 - Prompt code is broken with popups in e10s
support-files =
subtst_notifications_11.html
subtst_notifications_11_popup.html

Просмотреть файл

@ -74,13 +74,6 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_SAFE_BROWSING:
#ifdef MOZ_SAFE_BROWSING
true,
#else
false,
#endif
MOZ_SANDBOX:
#ifdef MOZ_SANDBOX
true,

Просмотреть файл

@ -6492,8 +6492,8 @@ AddonInstall.prototype = {
getService(Ci.nsIPromptFactory);
let prompt = factory.getPrompt(win, Ci.nsIAuthPrompt2);
if (this.browser && this.browser.isRemoteBrowser && prompt instanceof Ci.nsILoginManagerPrompter)
prompt.setE10sData(this.browser, null);
if (this.browser && prompt instanceof Ci.nsILoginManagerPrompter)
prompt.browser = this.browser;
return prompt;
}