Skip to content

Commit

Permalink
Merge mozilla-central to mozilla-inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
IrisHsiao committed May 18, 2017
2 parents 5308137 + 77020e4 commit 34b5af7
Show file tree
Hide file tree
Showing 147 changed files with 3,298 additions and 933 deletions.
34 changes: 33 additions & 1 deletion browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");

XPCOMUtils.defineLazyGetter(this, "extensionNameFromURI", () => {
return Cu.import("resource://gre/modules/ExtensionParent.jsm", {}).extensionNameFromURI;
});

// lazy module getters

/* global AboutHome:false,
Expand Down Expand Up @@ -6879,6 +6883,11 @@ var gIdentityHandler = {
*/
_uriHasHost: false,

/**
* Whether this is a "moz-extension:" page, loaded from a WebExtension.
*/
_isExtensionPage: false,

/**
* Whether this._uri refers to an internally implemented browser page.
*
Expand Down Expand Up @@ -7013,6 +7022,10 @@ var gIdentityHandler = {
delete this._connectionIcon;
return this._connectionIcon = document.getElementById("connection-icon");
},
get _extensionIcon() {
delete this._extensionIcon;
return this._extensionIcon = document.getElementById("extension-icon");
},
get _overrideService() {
delete this._overrideService;
return this._overrideService = Cc["@mozilla.org/security/certoverride;1"]
Expand Down Expand Up @@ -7291,7 +7304,11 @@ var gIdentityHandler = {
icon_labels_dir = /^[\u0590-\u08ff\ufb1d-\ufdff\ufe70-\ufefc]/.test(icon_label) ?
"rtl" : "ltr";
}

} else if (this._isExtensionPage) {
this._identityBox.className = "extensionPage";
let extensionName = extensionNameFromURI(this._uri);
icon_label = gNavigatorBundle.getFormattedString(
"identity.extension.label", [extensionName]);
} else if (this._uriHasHost && this._isSecure) {
this._identityBox.className = "verifiedDomain";
if (this._isMixedActiveContentBlocked) {
Expand Down Expand Up @@ -7359,6 +7376,13 @@ var gIdentityHandler = {

// Push the appropriate strings out to the UI
this._connectionIcon.tooltipText = tooltip;

if (this._isExtensionPage) {
let extensionName = extensionNameFromURI(this._uri);
this._extensionIcon.tooltipText = gNavigatorBundle.getFormattedString(
"identity.extension.tooltip", [extensionName]);
}

this._identityIconLabels.tooltipText = tooltip;
this._identityIcon.tooltipText = gNavigatorBundle.getString("identity.icon.tooltip");
this._identityIconLabel.value = icon_label;
Expand Down Expand Up @@ -7390,6 +7414,8 @@ var gIdentityHandler = {
let connection = "not-secure";
if (this._isSecureInternalUI) {
connection = "chrome";
} else if (this._isExtensionPage) {
connection = "extension";
} else if (this._isURILoadedFromFile) {
connection = "file";
} else if (this._isEV) {
Expand Down Expand Up @@ -7470,6 +7496,10 @@ var gIdentityHandler = {
hostless = true;
}

if (this._isExtensionPage) {
host = extensionNameFromURI(this._uri);
}

// Fill in the CA name if we have a valid TLS certificate.
if (this._isSecure || this._isCertUserOverridden) {
verifier = this._identityIconLabels.tooltipText;
Expand Down Expand Up @@ -7523,6 +7553,8 @@ var gIdentityHandler = {
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|searchreset|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.path);

this._isExtensionPage = uri.schemeIs("moz-extension");

// Create a channel for the sole purpose of getting the resolved URI
// of the request to determine if it's loaded from the file system.
this._isURILoadedFromFile = false;
Expand Down
1 change: 1 addition & 0 deletions browser/base/content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@
tooltiptext="&urlbar.persistentStorageNotificationAnchor.tooltip;"/>
</box>
<image id="connection-icon"/>
<image id="extension-icon"/>
<image id="remote-control-icon"
tooltiptext="&urlbar.remoteControlNotificationAnchor.tooltip;"/>
<hbox id="identity-icon-labels">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

/* globals
waitForExplicitFinish, whenNewWindowLoaded, whenNewTabLoaded,
executeSoon, registerCleanupFunction, finish, is
*/
/* exported test */

// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
function test() {
// initialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/. */
"use strict";
/* globals waitForExplicitFinish, executeSoon, finish, whenNewWindowLoaded, ok */
/* globals is */
/* exported test */

function test() {
// initialization
Expand Down
1 change: 1 addition & 0 deletions browser/components/controlcenter/content/panel.inc.xul
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
when-connection="secure secure-ev">&identity.connectionSecure;</description>
<description when-connection="chrome">&identity.connectionInternal;</description>
<description when-connection="file">&identity.connectionFile;</description>
<description when-connection="extension">&identity.extensionPage;</description>

<vbox id="identity-popup-security-descriptions">
<description class="identity-popup-warning-gray"
Expand Down
1 change: 0 additions & 1 deletion browser/components/extensions/ParseSymbols-worker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-env worker */
/* globals OS, ParseSymbols */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion browser/components/extensions/ext-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ extensions.on("page-shutdown", (type, context) => {
}
});
/* eslint-enable mozilla/balanced-listeners */
/* eslint-enable mozilla/balanced-listeners */

global.openOptionsPage = (extension) => {
let window = windowTracker.topWindow;
Expand Down
1 change: 0 additions & 1 deletion browser/components/extensions/ext-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");

/* globals TabBase, WindowBase, TabTrackerBase, WindowTrackerBase, TabManagerBase, WindowManagerBase */
Cu.import("resource://gre/modules/ExtensionTabs.jsm");

XPCOMUtils.defineLazyServiceGetter(this, "styleSheetService",
Expand Down
23 changes: 0 additions & 23 deletions browser/components/extensions/test/browser/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,6 @@ module.exports = {
"webextensions": true,
},

"globals": {
"NetUtil": true,
"XPCOMUtils": true,
"Task": true,

// Browser window globals.
"PanelUI": false,

// Test harness globals
"ExtensionTestUtils": false,
"TestUtils": false,

"clickBrowserAction": true,
"clickPageAction": true,
"closeContextMenu": true,
"closeExtensionContextMenu": true,
"focusWindow": true,
"makeWidgetId": true,
"openContextMenu": true,
"openExtensionContextMenu": true,
"CustomizableUI": true,
},

"rules": {
"no-shadow": 0,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ support-files =
[browser_ext_devtools_panel.js]
[browser_ext_geckoProfiler_symbolicate.js]
[browser_ext_getViews.js]
[browser_ext_identity_indication.js]
[browser_ext_incognito_views.js]
[browser_ext_incognito_popup.js]
[browser_ext_lastError.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

function confirmDefaults() {
let identityIconURL = getComputedStyle(document.getElementById("identity-icon")).listStyleImage;
is(identityIconURL, "url(\"chrome://browser/skin/identity-icon.svg#normal\")", "Identity icon should be the default identity icon");

let connectionIconURL = getComputedStyle(document.getElementById("connection-icon")).listStyleImage;
is(connectionIconURL, "none", "Connection icon should not be displayed");

let extensionIconURL = getComputedStyle(document.getElementById("extension-icon")).listStyleImage;
is(extensionIconURL, "none", "Extension icon should not be displayed");

let label = document.getElementById("identity-icon-label").value;
is(label, "", "No label should be used before the extension is started");
}

function confirmExtensionPage() {
let identityIcon = getComputedStyle(document.getElementById("identity-icon")).listStyleImage;
is(identityIcon, "url(\"chrome://browser/skin/identity-icon.svg#normal\")", "Identity icon should be the default identity icon");

let connectionIconURL = getComputedStyle(document.getElementById("connection-icon")).listStyleImage;
is(connectionIconURL, "none", "Connection icon should not be displayed");

let extensionIconEl = document.getElementById("extension-icon");
let extensionIconURL = getComputedStyle(extensionIconEl).listStyleImage;
is(extensionIconURL, "url(\"chrome://browser/skin/controlcenter/extension.svg\")", "Extension icon should be the default extension icon");
let tooltip = extensionIconEl.tooltipText;
is(tooltip, "Loaded by extension: Test Extension", "The correct tooltip should be used");

let label = document.getElementById("identity-icon-label").value;
is(label, "Extension (Test Extension)", "The correct label should be used");
}

add_task(async function testIdentityIndication() {
let extension = ExtensionTestUtils.loadExtension({
background() {
browser.test.sendMessage("url", browser.extension.getURL("icon.png"));
},
manifest: {
name: "Test Extension",
},
files: {
"icon.png": "",
},
});

await extension.startup();

confirmDefaults();

let url = await extension.awaitMessage("url");
await BrowserTestUtils.withNewTab({gBrowser, url}, async function() {
confirmExtensionPage();
});

await extension.unload();

confirmDefaults();
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

/* global runTests */

Services.scriptloader.loadSubScript(new URL("head_pageAction.js", gTestPath).href,
this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

/* global runTests */

Services.scriptloader.loadSubScript(new URL("head_pageAction.js", gTestPath).href,
this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

/* globals recordInitialTimestamps, onlyNewItemsFilter, checkRecentlyClosed */

requestLongerTimeout(2);

Services.scriptloader.loadSubScript(new URL("head_sessions.js", gTestPath).href,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

/* globals recordInitialTimestamps, onlyNewItemsFilter, checkRecentlyClosed */

SimpleTest.requestCompleteLog();

Services.scriptloader.loadSubScript(new URL("head_sessions.js", gTestPath).href,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* globals makeExtension */
"use strict";

/* import-globals-from ../../../../../toolkit/components/extensions/test/mochitest/head_webrequest.js */
Services.scriptloader.loadSubScript(new URL("head_webrequest.js", gTestPath).href,
this);

Expand Down Expand Up @@ -117,4 +117,3 @@ add_task(async function test_subframe() {
add_task(async function teardown() {
await extension.unload();
});

1 change: 0 additions & 1 deletion browser/components/extensions/test/browser/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ async function clickPageAction(extension, win = window) {
//
// Unfortunately, that doesn't happen automatically in browser chrome
// tests.
/* globals SetPageProxyState */
SetPageProxyState("valid");

await promiseAnimationFrame(win);
Expand Down
4 changes: 2 additions & 2 deletions browser/components/extensions/test/browser/head_pageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"use strict";

/* exported runTests */
/* globals getListStyleImage, promiseAnimationFrame */
// This file is imported into the same scope as head.js.
/* import-globals-from head.js */

async function runTests(options) {
function background(getTests) {
Expand Down Expand Up @@ -157,4 +158,3 @@ async function runTests(options) {
await BrowserTestUtils.closeWindow(win);
}
}

2 changes: 0 additions & 2 deletions browser/components/feeds/content/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,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/. */

/* global BrowserFeedWriter */

var SubscribeHandler = {
/**
* The nsIFeedWriter object that produces the UI
Expand Down
4 changes: 2 additions & 2 deletions browser/components/migration/360seProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
Expand Down
1 change: 0 additions & 1 deletion browser/components/migration/AutoMigrate.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {

Cu.importGlobalProperties(["URL"]);

/* globals kUndoStateFullPath */
XPCOMUtils.defineLazyGetter(this, "kUndoStateFullPath", function() {
return OS.Path.join(OS.Constants.Path.profileDir, "initialMigrationMetadata.jsonlz4");
});
Expand Down
4 changes: 2 additions & 2 deletions browser/components/migration/ChromeProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
Expand Down
4 changes: 2 additions & 2 deletions browser/components/migration/EdgeProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;

Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource:///modules/MSMigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
Expand Down
2 changes: 1 addition & 1 deletion browser/components/migration/FirefoxProfileMigrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
Expand Down
Loading

0 comments on commit 34b5af7

Please sign in to comment.