--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -489,16 +489,37 @@ toolbar:not(#TabsToolbar) > #personal-bo
width: 1px;
min-width: 1px;
}
#urlbar {
-moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar);
}
+/*
+ * Display visual cue that browser is under remote control by Marionette.
+ * This is to help users visually distinguish a user agent session that
+ * is under remote control from those used for normal browsing sessions.
+ *
+ * Attribute is controlled by browser.js:/gRemoteControl.
+ */
+#main-window[remotecontrol] #urlbar {
+ background: repeating-linear-gradient(
+ -45deg,
+ transparent,
+ transparent 25px,
+ rgba(255,255,255,.3) 25px,
+ rgba(255,255,255,.3) 50px);
+ background-color: rgba(255,170,68,.8);
+ color: black;
+}
+#main-window[remotecontrol] #urlbar #identity-box {
+ background: white;
+}
+
/* Fade out URL on overflow */
html|input.urlbar-input[textoverflow]:not([focused]) {
/* Don't need to worry about RTL here since we use direction:ltr for the
input field. */
mask-image: linear-gradient(to left, transparent, black 3em);
}
/* Apply crisp rendering for favicons at exactly 2dppx resolution */
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -28,17 +28,18 @@ XPCOMUtils.defineLazyModuleGetter(this,
LoginManagerParent:false, NewTabUtils:false, PageThumbs:false,
PluralForm:false, Preferences:false, PrivateBrowsingUtils:false,
ProcessHangMonitor:false, PromiseUtils:false, ReaderMode:false,
ReaderParent:false, RecentWindow:false, SessionStore:false,
ShortcutUtils:false, SimpleServiceDiscovery:false, SitePermissions:false,
Social:false, TabCrashHandler:false, Task:false, TelemetryStopwatch:false,
Translation:false, UITour:false, UpdateUtils:false, Weave:false,
WebNavigationFrames: false, fxAccounts:false, gDevTools:false,
- gDevToolsBrowser:false, webrtcUI:false, FullZoomUI:false
+ gDevToolsBrowser:false, webrtcUI:false, FullZoomUI:false,
+ Marionette:false,
*/
/**
* IF YOU ADD OR REMOVE FROM THIS LIST, PLEASE UPDATE THE LIST ABOVE AS WELL.
* XXX Bug 1325373 is for making eslint detect these automatically.
*/
[
["AboutHome", "resource:///modules/AboutHome.jsm"],
@@ -101,19 +102,20 @@ if (AppConstants.MOZ_CRASHREPORTER) {
gDNSService:false
*/
/**
* IF YOU ADD OR REMOVE FROM THIS LIST, PLEASE UPDATE THE LIST ABOVE AS WELL.
* XXX Bug 1325373 is for making eslint detect these automatically.
*/
[
["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"],
- ["WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
["gAboutNewTabService", "@mozilla.org/browser/aboutnewtab-service;1", "nsIAboutNewTabService"],
["gDNSService", "@mozilla.org/network/dns-service;1", "nsIDNSService"],
+ ["Marionette", "@mozilla.org/remote/marionette;1", "nsIMarionette"],
+ ["WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
].forEach(([name, cc, ci]) => XPCOMUtils.defineLazyServiceGetter(this, name, cc, ci));
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
"@mozilla.org/xre/app-info;1",
"nsICrashReporter");
}
@@ -1250,16 +1252,18 @@ var gBrowserInit = {
// Default to black for foreground text.
if (!windowFrameColor.isContrastRatioAcceptable(new Color(0, 0, 0))) {
document.documentElement.setAttribute("darkwindowframe", "true");
}
}
ToolbarIconColor.init();
+ gRemoteControl.updateVisualCue(Marionette.running);
+
// Wait until chrome is painted before executing code not critical to making the window visible
this._boundDelayedStartup = this._delayedStartup.bind(this);
window.addEventListener("MozAfterPaint", this._boundDelayedStartup);
this._loadHandled = true;
},
_cancelDelayedStartup() {
@@ -1388,16 +1392,17 @@ var gBrowserInit = {
loadOneOrMoreURIs(uriToLoad);
}
}
// 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");
+ Services.obs.addObserver(gRemoteControl, "remote-active");
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history");
Services.obs.addObserver(gStoragePressureObserver, "QuotaManager::StoragePressure");
Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled");
Services.obs.addObserver(gXPInstallObserver, "addon-install-started");
Services.obs.addObserver(gXPInstallObserver, "addon-install-blocked");
Services.obs.addObserver(gXPInstallObserver, "addon-install-origin-blocked");
Services.obs.addObserver(gXPInstallObserver, "addon-install-failed");
Services.obs.addObserver(gXPInstallObserver, "addon-install-confirmation");
@@ -1708,16 +1713,17 @@ var gBrowserInit = {
gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
ctrlTab.uninit();
SocialUI.uninit();
gBrowserThumbnails.uninit();
FullZoom.destroy();
Services.obs.removeObserver(gIdentityHandler, "perm-changed");
+ Services.obs.removeObserver(gRemoteControl, "remote-active");
Services.obs.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
Services.obs.removeObserver(gStoragePressureObserver, "QuotaManager::StoragePressure");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-disabled");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-started");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-blocked");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-origin-blocked");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-failed");
Services.obs.removeObserver(gXPInstallObserver, "addon-install-confirmation");
@@ -7812,17 +7818,16 @@ var gIdentityHandler = {
container.appendChild(nameLabel);
container.appendChild(stateLabel);
container.appendChild(button);
return container;
}
};
-
var gPageActionButton = {
get button() {
delete this.button;
return this.button = document.getElementById("urlbar-page-action-button");
},
get panel() {
delete this.panel;
@@ -7844,16 +7849,35 @@ var gPageActionButton = {
return; // Left click, space or enter only
}
this.panel.hidden = false;
this.panel.openPopup(this.button, "bottomcenter topright");
},
};
+/**
+ * Fired on the "marionette-remote-control" system notification,
+ * indicating if the browser session is under remote control.
+ */
+const gRemoteControl = {
+ observe(subject, topic, data) {
+ gRemoteControl.updateVisualCue(data);
+ },
+
+ updateVisualCue(enabled) {
+ const mainWindow = document.documentElement;
+ if (enabled) {
+ mainWindow.setAttribute("remotecontrol", "true");
+ } else {
+ mainWindow.removeAttribute("remotecontrol");
+ }
+ },
+};
+
function getNotificationBox(aWindow) {
var foundBrowser = gBrowser.getBrowserForDocument(aWindow.document);
if (foundBrowser)
return gBrowser.getNotificationBox(foundBrowser)
return null;
}
function getTabModalPromptBox(aWindow) {