mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge fx-team to mozilla-central a=merge
This commit is contained in:
commit
cf2e3c9c87
@ -28,7 +28,7 @@
|
||||
oncommand="MailIntegration.sendLinkForBrowser(gBrowser.selectedBrowser);"/>
|
||||
|
||||
<command id="cmd_pageSetup" oncommand="PrintUtils.showPageSetup();"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.print(window.gBrowser.selectedBrowser.contentWindowAsCPOW, window.gBrowser.selectedBrowser);"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.printWindow(window.gBrowser.selectedBrowser.outerWindowID, window.gBrowser.selectedBrowser);"/>
|
||||
<command id="cmd_printPreview" oncommand="PrintUtils.printPreview(PrintPreviewListener);"/>
|
||||
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow()" reserved="true"/>
|
||||
<command id="cmd_closeWindow" oncommand="BrowserTryToCloseWindow()" reserved="true"/>
|
||||
|
@ -3,7 +3,10 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
let TrackingProtection = {
|
||||
PREF_ENABLED: "privacy.trackingprotection.enabled",
|
||||
PREF_ENABLED_GLOBALLY: "privacy.trackingprotection.enabled",
|
||||
PREF_ENABLED_IN_PRIVATE_WINDOWS: "privacy.trackingprotection.pbmode.enabled",
|
||||
enabledGlobally: false,
|
||||
enabledInPrivateWindows: false,
|
||||
|
||||
init() {
|
||||
let $ = selector => document.querySelector(selector);
|
||||
@ -11,21 +14,32 @@ let TrackingProtection = {
|
||||
this.content = $("#tracking-protection-content");
|
||||
|
||||
this.updateEnabled();
|
||||
Services.prefs.addObserver(this.PREF_ENABLED, this, false);
|
||||
Services.prefs.addObserver(this.PREF_ENABLED_GLOBALLY, this, false);
|
||||
Services.prefs.addObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this, false);
|
||||
|
||||
this.enabledHistogram.add(this.enabled);
|
||||
this.enabledHistogram.add(this.enabledGlobally);
|
||||
},
|
||||
|
||||
uninit() {
|
||||
Services.prefs.removeObserver(this.PREF_ENABLED, this);
|
||||
Services.prefs.removeObserver(this.PREF_ENABLED_GLOBALLY, this);
|
||||
Services.prefs.removeObserver(this.PREF_ENABLED_IN_PRIVATE_WINDOWS, this);
|
||||
},
|
||||
|
||||
observe() {
|
||||
this.updateEnabled();
|
||||
},
|
||||
|
||||
get enabled() {
|
||||
return this.enabledGlobally ||
|
||||
(this.enabledInPrivateWindows &&
|
||||
PrivateBrowsingUtils.isWindowPrivate(window));
|
||||
},
|
||||
|
||||
updateEnabled() {
|
||||
this.enabled = Services.prefs.getBoolPref(this.PREF_ENABLED);
|
||||
this.enabledGlobally =
|
||||
Services.prefs.getBoolPref(this.PREF_ENABLED_GLOBALLY);
|
||||
this.enabledInPrivateWindows =
|
||||
Services.prefs.getBoolPref(this.PREF_ENABLED_IN_PRIVATE_WINDOWS);
|
||||
this.container.hidden = !this.enabled;
|
||||
},
|
||||
|
||||
|
@ -1787,8 +1787,8 @@ function HandleAppCommandEvent(evt) {
|
||||
BrowserOpenFileWindow();
|
||||
break;
|
||||
case "Print":
|
||||
PrintUtils.print(gBrowser.selectedBrowser.contentWindowAsCPOW,
|
||||
gBrowser.selectedBrowser);
|
||||
PrintUtils.printWindow(gBrowser.selectedBrowser.outerWindowID,
|
||||
gBrowser.selectedBrowser);
|
||||
break;
|
||||
case "Save":
|
||||
saveDocument(gBrowser.selectedBrowser.contentDocumentAsCPOW);
|
||||
|
@ -1681,7 +1681,7 @@ nsContextMenu.prototype = {
|
||||
},
|
||||
|
||||
printFrame: function CM_printFrame() {
|
||||
PrintUtils.print(this.target.ownerDocument.defaultView, this.browser);
|
||||
PrintUtils.printWindow(this.frameOuterWindowID, this.browser);
|
||||
},
|
||||
|
||||
switchPageDirection: function CM_switchPageDirection() {
|
||||
|
@ -410,10 +410,17 @@ skip-if = e10s # Bug 1100664 - test relies on linkedBrowser.docShell
|
||||
[browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
|
||||
run-if = e10s
|
||||
[browser_trackingUI_1.js]
|
||||
tags = trackingprotection
|
||||
support-files =
|
||||
trackingPage.html
|
||||
benignPage.html
|
||||
[browser_trackingUI_2.js]
|
||||
tags = trackingprotection
|
||||
support-files =
|
||||
trackingPage.html
|
||||
benignPage.html
|
||||
[browser_trackingUI_3.js]
|
||||
tags = trackingprotection
|
||||
support-files =
|
||||
trackingPage.html
|
||||
benignPage.html
|
||||
|
@ -7,34 +7,40 @@
|
||||
// * A page with no tracking elements is loaded.
|
||||
// * A page with tracking elements is loaded and they are blocked.
|
||||
// * A page with tracking elements is loaded and they are not blocked.
|
||||
// See also Bugs 1175327 and 1043801.
|
||||
// See also Bugs 1175327, 1043801, 1178985
|
||||
|
||||
let PREF = "privacy.trackingprotection.enabled";
|
||||
let BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||
let TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||
const PREF = "privacy.trackingprotection.enabled";
|
||||
const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||
let TrackingProtection = null;
|
||||
let browser = null;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
TrackingProtection = null;
|
||||
TrackingProtection = browser = null;
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
gBrowser.removeCurrentTab();
|
||||
Services.prefs.clearUserPref(PB_PREF);
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
});
|
||||
|
||||
function hidden(sel) {
|
||||
let win = gBrowser.ownerGlobal;
|
||||
let win = browser.ownerGlobal;
|
||||
let el = win.document.querySelector(sel);
|
||||
let display = win.getComputedStyle(el).getPropertyValue("display", null);
|
||||
return display === "none";
|
||||
}
|
||||
|
||||
function clickButton(sel) {
|
||||
let win = gBrowser.ownerGlobal;
|
||||
let win = browser.ownerGlobal;
|
||||
let el = win.document.querySelector(sel);
|
||||
el.doCommand();
|
||||
}
|
||||
|
||||
function testBenignPage() {
|
||||
info("Non-tracking content must not be blocked");
|
||||
ok (!TrackingProtection.container.hidden, "The container is visible");
|
||||
ok (!TrackingProtection.content.hasAttribute("block-disabled"), "blocking not disabled");
|
||||
ok (!TrackingProtection.content.hasAttribute("block-active"), "blocking is not active");
|
||||
|
||||
@ -49,6 +55,7 @@ function testBenignPage() {
|
||||
|
||||
function testTrackingPage() {
|
||||
info("Tracking content must be blocked");
|
||||
ok (!TrackingProtection.container.hidden, "The container is visible");
|
||||
ok (!TrackingProtection.content.hasAttribute("block-disabled"), "blocking not disabled");
|
||||
ok (TrackingProtection.content.hasAttribute("block-active"), "blocking is active");
|
||||
|
||||
@ -63,6 +70,7 @@ function testTrackingPage() {
|
||||
|
||||
function testTrackingPageWhitelisted() {
|
||||
info("Tracking content must be white-listed and not blocked");
|
||||
ok (!TrackingProtection.container.hidden, "The container is visible");
|
||||
ok (TrackingProtection.content.hasAttribute("block-disabled"), "blocking is disabled");
|
||||
ok (!TrackingProtection.content.hasAttribute("block-active"), "blocking is not active");
|
||||
|
||||
@ -75,19 +83,7 @@ function testTrackingPageWhitelisted() {
|
||||
ok (hidden("#tracking-blocked"), "labelTrackingBlocked is hidden");
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
yield updateTrackingProtectionDatabase();
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "Functionality is attached to the browser window");
|
||||
is (TrackingProtection.enabled, Services.prefs.getBoolPref(PREF),
|
||||
"TP.enabled is based on the original pref value");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled after setting the pref");
|
||||
|
||||
function* testTrackingProtectionForTab(tab) {
|
||||
info("Load a test page not containing tracking elements");
|
||||
yield promiseTabLoadEvent(tab, BENIGN_PAGE);
|
||||
testBenignPage();
|
||||
@ -109,4 +105,45 @@ add_task(function* () {
|
||||
info("Wait for tab to reload following TP black-listing");
|
||||
yield promiseTabLoadEvent(tab);
|
||||
testTrackingPage();
|
||||
}
|
||||
|
||||
add_task(function* testNormalBrowsing() {
|
||||
yield updateTrackingProtectionDatabase();
|
||||
|
||||
browser = gBrowser;
|
||||
let tab = browser.selectedTab = browser.addTab();
|
||||
|
||||
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the browser window");
|
||||
is (TrackingProtection.enabled, Services.prefs.getBoolPref(PREF),
|
||||
"TP.enabled is based on the original pref value");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled after setting the pref");
|
||||
|
||||
yield testTrackingProtectionForTab(tab);
|
||||
|
||||
Services.prefs.setBoolPref(PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled after setting the pref");
|
||||
});
|
||||
|
||||
add_task(function* testPrivateBrowsing() {
|
||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||
browser = privateWin.gBrowser;
|
||||
let tab = browser.selectedTab = browser.addTab();
|
||||
|
||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the private window");
|
||||
is (TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
||||
"TP.enabled is based on the pb pref value");
|
||||
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled after setting the pref");
|
||||
|
||||
yield testTrackingProtectionForTab(tab);
|
||||
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled after setting the pref");
|
||||
|
||||
privateWin.close();
|
||||
});
|
||||
|
@ -4,45 +4,73 @@
|
||||
|
||||
// Test that the Tracking Protection section is never visible in the
|
||||
// Control Center when the feature is off.
|
||||
// See also Bugs 1175327 and 1043801.
|
||||
// See also Bugs 1175327, 1043801, 1178985.
|
||||
|
||||
let PREF = "privacy.trackingprotection.enabled";
|
||||
let BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||
let TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||
const PREF = "privacy.trackingprotection.enabled";
|
||||
const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||
let TrackingProtection = null;
|
||||
let browser = null;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
TrackingProtection = null;
|
||||
TrackingProtection = browser = null;
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
gBrowser.removeCurrentTab();
|
||||
Services.prefs.clearUserPref(PB_PREF);
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
});
|
||||
|
||||
function testTrackingPageOff() {
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
}
|
||||
|
||||
function testBenignPageOff() {
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
}
|
||||
|
||||
add_task(function* () {
|
||||
add_task(function* testNormalBrowsing() {
|
||||
yield updateTrackingProtectionDatabase();
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
browser = gBrowser;
|
||||
let tab = browser.selectedTab = browser.addTab();
|
||||
|
||||
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the browser window");
|
||||
is (TrackingProtection.enabled, Services.prefs.getBoolPref(PREF),
|
||||
"TP.enabled is based on the original pref value");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled after setting the pref");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled after setting the pref");
|
||||
|
||||
info("Load a test page containing tracking elements");
|
||||
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
|
||||
testTrackingPageOff();
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
|
||||
info("Load a test page not containing tracking elements");
|
||||
yield promiseTabLoadEvent(tab, BENIGN_PAGE);
|
||||
testBenignPageOff();
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
});
|
||||
|
||||
add_task(function* testPrivateBrowsing() {
|
||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||
browser = privateWin.gBrowser;
|
||||
let tab = browser.selectedTab = browser.addTab();
|
||||
|
||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the private window");
|
||||
is (TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
||||
"TP.enabled is based on the pb pref value");
|
||||
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled after setting the pref");
|
||||
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled after setting the pref");
|
||||
|
||||
info("Load a test page containing tracking elements");
|
||||
yield promiseTabLoadEvent(tab, TRACKING_PAGE);
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
|
||||
info("Load a test page not containing tracking elements");
|
||||
yield promiseTabLoadEvent(tab, BENIGN_PAGE);
|
||||
ok (TrackingProtection.container.hidden, "The container is hidden");
|
||||
|
||||
privateWin.close();
|
||||
});
|
||||
|
59
browser/base/content/test/general/browser_trackingUI_3.js
Normal file
59
browser/base/content/test/general/browser_trackingUI_3.js
Normal file
@ -0,0 +1,59 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
// Test that the Tracking Protection is correctly enabled / disabled
|
||||
// in both normal and private windows given all possible states of the prefs:
|
||||
// privacy.trackingprotection.enabled
|
||||
// privacy.trackingprotection.pbmode.enabled
|
||||
// See also Bug 1178985.
|
||||
|
||||
const PREF = "privacy.trackingprotection.enabled";
|
||||
const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
Services.prefs.clearUserPref(PB_PREF);
|
||||
});
|
||||
|
||||
add_task(function* testNormalBrowsing() {
|
||||
let browser = gBrowser;
|
||||
let TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the browser window");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=false)");
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=true)");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, false);
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled (ENABLED=false,PB=false)");
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled (ENABLED=false,PB=true)");
|
||||
});
|
||||
|
||||
add_task(function* testPrivateBrowsing() {
|
||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||
let browser = privateWin.gBrowser;
|
||||
|
||||
let TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
||||
ok (TrackingProtection, "TP is attached to the browser window");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, true);
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=false)");
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=true)");
|
||||
|
||||
Services.prefs.setBoolPref(PREF, false);
|
||||
Services.prefs.setBoolPref(PB_PREF, false);
|
||||
ok (!TrackingProtection.enabled, "TP is disabled (ENABLED=false,PB=false)");
|
||||
Services.prefs.setBoolPref(PB_PREF, true);
|
||||
ok (TrackingProtection.enabled, "TP is enabled (ENABLED=false,PB=true)");
|
||||
|
||||
privateWin.close();
|
||||
});
|
@ -4,54 +4,11 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const Cu = Components.utils;
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
|
||||
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let TargetFactory = devtools.TargetFactory;
|
||||
const DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils");
|
||||
// shared-head.js handles imports, constants, and utility functions
|
||||
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/browser/devtools/framework/test/shared-head.js", this);
|
||||
|
||||
const BASE_URI = "http://mochi.test:8888/browser/browser/devtools/fontinspector/test/"
|
||||
|
||||
// All test are asynchronous
|
||||
waitForExplicitFinish();
|
||||
|
||||
DevToolsUtils.testing = true;
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
DevToolsUtils.testing = false;
|
||||
});
|
||||
|
||||
registerCleanupFunction(function*() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
yield gDevTools.closeToolbox(target);
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a new test tab in the browser and load the given url.
|
||||
* @param {String} url The url to be loaded in the new tab
|
||||
* @return a promise that resolves to the tab object when the url is loaded
|
||||
*/
|
||||
function loadTab(url) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
|
||||
let browser = gBrowser.getBrowserForTab(tab);
|
||||
|
||||
browser.addEventListener("load", function onLoad() {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
deferred.resolve({tab: tab, browser: browser});
|
||||
}, true);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the toolbox, with the inspector tool visible.
|
||||
* @param {Function} cb Optional callback, if you don't want to use the returned
|
||||
@ -114,7 +71,7 @@ let openInspector = Task.async(function*(cb) {
|
||||
*/
|
||||
let openFontInspectorForURL = Task.async(function* (url) {
|
||||
info("Opening tab " + url);
|
||||
yield loadTab(url);
|
||||
yield addTab(url);
|
||||
|
||||
let { toolbox, inspector } = yield openInspector();
|
||||
|
||||
|
@ -13,7 +13,6 @@ thisTestLeaksUncaughtRejectionsAndShouldBeFixed("TypeError: this.doc is undefine
|
||||
|
||||
// Tests devtools API
|
||||
|
||||
const Cu = Components.utils;
|
||||
const toolId1 = "test-tool-1";
|
||||
const toolId2 = "test-tool-2";
|
||||
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
// Tests devtools API
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
function test() {
|
||||
addTab("about:blank").then(runTests);
|
||||
}
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
// Tests devtools API
|
||||
|
||||
const Cu = Components.utils;
|
||||
|
||||
let toolbox, target;
|
||||
|
||||
let tempScope = {};
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// Test that the sidebar widget auto-registers existing tabs.
|
||||
|
||||
const Cu = Components.utils;
|
||||
const {ToolSidebar} = devtools.require("devtools/framework/sidebar");
|
||||
|
||||
const testToolURL = "data:text/xml;charset=utf8,<?xml version='1.0'?>" +
|
||||
|
@ -3,12 +3,16 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This shared-head.js file is used for multiple directories in devtools.
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
const {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
const {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
|
||||
const {Promise: promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
const {ScratchpadManager} = Cu.import("resource:///modules/devtools/scratchpad-manager.jsm", {});
|
||||
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
const {require} = devtools;
|
||||
const {TargetFactory} = devtools;
|
||||
const DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils");
|
||||
const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
|
||||
const promise = require("promise");
|
||||
|
||||
const TEST_DIR = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
|
||||
const CHROME_URL_ROOT = TEST_DIR + "/";
|
||||
@ -38,13 +42,15 @@ registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.toolbox.previousHost");
|
||||
});
|
||||
|
||||
registerCleanupFunction(function cleanup() {
|
||||
registerCleanupFunction(function* cleanup() {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
yield gDevTools.closeToolbox(target);
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Add a new test tab in the browser and load the given url.
|
||||
* @param {String} url The url to be loaded in the new tab
|
||||
@ -54,13 +60,12 @@ function addTab(url) {
|
||||
info("Adding a new tab with URL: '" + url + "'");
|
||||
let def = promise.defer();
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onload() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onload, true);
|
||||
info("URL '" + url + "' loading complete");
|
||||
def.resolve(tab);
|
||||
}, true);
|
||||
content.location = url;
|
||||
|
||||
return def.promise;
|
||||
}
|
||||
|
@ -202,6 +202,12 @@ public class FxAccountStatusActivity extends LocaleAwareFragmentActivity {
|
||||
boolean enabled = !AppConstants.MOZILLA_OFFICIAL || AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD;
|
||||
if (!enabled) {
|
||||
menu.removeItem(R.id.enable_debug_mode);
|
||||
} else {
|
||||
final MenuItem debugModeItem = menu.findItem(R.id.enable_debug_mode);
|
||||
if (debugModeItem != null) {
|
||||
// Update checked state based on internal flag.
|
||||
menu.findItem(R.id.enable_debug_mode).setChecked(FxAccountUtils.LOG_PERSONAL_INFORMATION);
|
||||
}
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
};
|
||||
|
@ -203,8 +203,7 @@
|
||||
<method name="print">
|
||||
<body>
|
||||
<![CDATA[
|
||||
let contentWindow = this.mPPBrowser.contentWindowAsCPOW;
|
||||
PrintUtils.print(contentWindow, this.mPPBrowser);
|
||||
PrintUtils.printWindow(this.mPPBrowser.outerWindowID, this.mPPBrowser);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -30,18 +30,14 @@
|
||||
* Messages sent:
|
||||
*
|
||||
* Printing:Print
|
||||
* This message is sent to kick off a print job for a particular content
|
||||
* window (which is passed along with the message). We also pass print
|
||||
* settings with this message - though bug 1088070 will have us gather
|
||||
* those settings from the content process instead.
|
||||
* Kick off a print job for a nsIDOMWindow, passing the outer window ID as
|
||||
* windowID.
|
||||
*
|
||||
* Printing:Preview:Enter
|
||||
* This message is sent to put content into print preview mode. We pass
|
||||
* the content window of the browser we're showing the preview of, and
|
||||
* the target of the message is the browser that we'll be showing the
|
||||
* preview in. We also pass print settings in this message, but
|
||||
* bug 1088070 will have us gather those settings from the content process
|
||||
* instead.
|
||||
* preview in.
|
||||
*
|
||||
* Printing:Preview:Exit
|
||||
* This message is sent to take content out of print preview mode.
|
||||
@ -95,59 +91,58 @@ var PrintUtils = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Starts printing the contents of aWindow.
|
||||
* Starts the process of printing the contents of a window.
|
||||
*
|
||||
* @param aWindow
|
||||
* An nsIDOMWindow to initiate the printing of. If the chrome window
|
||||
* is not running with remote tabs, this defaults to window.content if
|
||||
* omitted. If running with remote tabs, the caller must pass in the
|
||||
* content window to be printed. This function throws if that invariant
|
||||
* is violated.
|
||||
* @param aBrowser (optional for non-remote browsers)
|
||||
* The remote <xul:browser> that contains aWindow. This argument is
|
||||
* not necessary if aWindow came from a non-remote browser, but is
|
||||
* strictly required otherwise. This function will throw if aWindow
|
||||
* comes from a remote browser and aBrowser is not provided. This
|
||||
* browser must have its type attribute set to "content",
|
||||
* "content-targetable", or "content-primary".
|
||||
* @param aWindowID
|
||||
* The outer window ID of the nsIDOMWindow to print.
|
||||
* @param aBrowser
|
||||
* The <xul:browser> that the nsIDOMWindow for aWindowID belongs to.
|
||||
*/
|
||||
print: function (aWindow, aBrowser)
|
||||
printWindow: function (aWindowID, aBrowser)
|
||||
{
|
||||
if (!aWindow) {
|
||||
// If we're using remote browsers, chances are that window.content will
|
||||
// not be defined.
|
||||
if (this.usingRemoteTabs) {
|
||||
throw new Error("Windows running with remote tabs must explicitly pass " +
|
||||
"a content window to PrintUtils.print.");
|
||||
}
|
||||
// Otherwise, we should have access to window.content.
|
||||
aWindow = window.content;
|
||||
let mm = aBrowser.messageManager;
|
||||
mm.sendAsyncMessage("Printing:Print", {
|
||||
windowID: aWindowID,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
* Starts the process of printing the contents of window.content.
|
||||
*
|
||||
*/
|
||||
print: function ()
|
||||
{
|
||||
if (gBrowser) {
|
||||
return this.printWindow(gBrowser.selectedBrowser.outerWindowID,
|
||||
gBrowser.selectedBrowser);
|
||||
}
|
||||
|
||||
if (Components.utils.isCrossProcessWrapper(aWindow)) {
|
||||
if (!aBrowser) {
|
||||
throw new Error("PrintUtils.print expects a remote browser passed as " +
|
||||
"an argument if the content window is a CPOW.");
|
||||
}
|
||||
} else {
|
||||
// For content windows coming from non-remote browsers, the browser can
|
||||
// be resolved as the chromeEventHandler.
|
||||
aBrowser = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.chromeEventHandler;
|
||||
if (this.usingRemoteTabs) {
|
||||
throw new Error("PrintUtils.print cannot be run in windows running with " +
|
||||
"remote tabs. Use PrintUtils.printWindow instead.");
|
||||
}
|
||||
|
||||
if (!aBrowser) {
|
||||
let domWindow = window.content;
|
||||
let ifReq = domWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
|
||||
let browser = ifReq.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.chromeEventHandler;
|
||||
if (!browser) {
|
||||
throw new Error("PrintUtils.print could not resolve content window " +
|
||||
"to a browser.");
|
||||
}
|
||||
|
||||
let mm = aBrowser.messageManager;
|
||||
let windowID = ifReq.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.outerWindowID;
|
||||
|
||||
mm.sendAsyncMessage("Printing:Print", null, {
|
||||
contentWindow: aWindow,
|
||||
});
|
||||
let Deprecated = Components.utils.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
|
||||
let msg = "PrintUtils.print is now deprecated. Please use PrintUtils.printWindow.";
|
||||
let url = "https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Printing";
|
||||
Deprecated.warning(msg, url);
|
||||
|
||||
this.printWindow(windowID, browser);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -410,9 +405,8 @@ var PrintUtils = {
|
||||
// listener.
|
||||
let ppBrowser = this._listener.getPrintPreviewBrowser();
|
||||
let mm = ppBrowser.messageManager;
|
||||
mm.sendAsyncMessage("Printing:Preview:Enter", null, {
|
||||
contentWindow: this._sourceBrowser.contentWindowAsCPOW ||
|
||||
this._sourceBrowser.contentWindow,
|
||||
mm.sendAsyncMessage("Printing:Preview:Enter", {
|
||||
windowID: this._sourceBrowser.outerWindowID,
|
||||
});
|
||||
|
||||
if (this._webProgressPP.value) {
|
||||
|
@ -7,6 +7,10 @@ support-files =
|
||||
|
||||
[test_lookup_system_principal.html]
|
||||
[test_classified_annotations.html]
|
||||
tags = trackingprotection
|
||||
[test_allowlisted_annotations.html]
|
||||
tags = trackingprotection
|
||||
[test_privatebrowsing_trackingprotection.html]
|
||||
tags = trackingprotection
|
||||
[test_trackingprotection_bug1157081.html]
|
||||
tags = trackingprotection
|
||||
|
@ -39,7 +39,7 @@
|
||||
<stringbundle id="viewSourceBundle" src="chrome://global/locale/viewSource.properties"/>
|
||||
|
||||
<command id="cmd_savePage" oncommand="ViewSourceSavePage();"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.print();"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.printWindow(gBrowser.outerWindowID, gBrowser);"/>
|
||||
<command id="cmd_printpreview" oncommand="PrintUtils.printPreview(PrintPreviewListener);"/>
|
||||
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
|
||||
<command id="cmd_close" oncommand="window.close();"/>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<stringbundle id="viewSourceBundle" src="chrome://global/locale/viewSource.properties"/>
|
||||
|
||||
<command id="cmd_savePage" oncommand="ViewSourceSavePage();"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.print(gBrowser.contentWindowAsCPOW, gBrowser);"/>
|
||||
<command id="cmd_print" oncommand="PrintUtils.printWindow(gBrowser.outerWindowID, gBrowser);"/>
|
||||
<command id="cmd_printpreview" oncommand="PrintUtils.printPreview(PrintPreviewListener);"/>
|
||||
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
|
||||
<command id="cmd_close" oncommand="window.close();"/>
|
||||
|
@ -392,7 +392,7 @@ let Printing = {
|
||||
let data = message.data;
|
||||
switch(message.name) {
|
||||
case "Printing:Preview:Enter": {
|
||||
this.enterPrintPreview(objects.contentWindow);
|
||||
this.enterPrintPreview(Services.wm.getOuterWindowWithId(data.windowID));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ let Printing = {
|
||||
}
|
||||
|
||||
case "Printing:Print": {
|
||||
this.print(objects.contentWindow);
|
||||
this.print(Services.wm.getOuterWindowWithId(data.windowID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user