mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound.
This commit is contained in:
commit
ecbbdd9bb1
@ -12,6 +12,10 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LayoutHelpers",
|
||||
"resource:///modules/devtools/LayoutHelpers.jsm");
|
||||
|
||||
// String used as an indication to generate default file name in the following
|
||||
// format: "Screen Shot yyyy-mm-dd at HH.MM.SS.png"
|
||||
const FILENAME_DEFAULT_VALUE = " ";
|
||||
|
||||
/**
|
||||
* 'screenshot' command
|
||||
*/
|
||||
@ -19,57 +23,86 @@ gcli.addCommand({
|
||||
name: "screenshot",
|
||||
description: gcli.lookup("screenshotDesc"),
|
||||
manual: gcli.lookup("screenshotManual"),
|
||||
returnType: "string",
|
||||
returnType: "html",
|
||||
params: [
|
||||
{
|
||||
name: "filename",
|
||||
type: "string",
|
||||
defaultValue: FILENAME_DEFAULT_VALUE,
|
||||
description: gcli.lookup("screenshotFilenameDesc"),
|
||||
manual: gcli.lookup("screenshotFilenameManual")
|
||||
},
|
||||
{
|
||||
name: "delay",
|
||||
type: { name: "number", min: 0 },
|
||||
defaultValue: 0,
|
||||
description: gcli.lookup("screenshotDelayDesc"),
|
||||
manual: gcli.lookup("screenshotDelayManual")
|
||||
},
|
||||
{
|
||||
name: "fullpage",
|
||||
type: "boolean",
|
||||
description: gcli.lookup("screenshotFullPageDesc"),
|
||||
manual: gcli.lookup("screenshotFullPageManual")
|
||||
},
|
||||
{
|
||||
name: "selector",
|
||||
type: "node",
|
||||
defaultValue: null,
|
||||
description: gcli.lookup("inspectNodeDesc"),
|
||||
manual: gcli.lookup("inspectNodeManual")
|
||||
group: gcli.lookup("screenshotGroupOptions"),
|
||||
params: [
|
||||
{
|
||||
name: "clipboard",
|
||||
type: "boolean",
|
||||
description: gcli.lookup("screenshotClipboardDesc"),
|
||||
manual: gcli.lookup("screenshotClipboardManual")
|
||||
},
|
||||
{
|
||||
name: "chrome",
|
||||
type: "boolean",
|
||||
description: gcli.lookup("screenshotChromeDesc"),
|
||||
manual: gcli.lookup("screenshotChromeManual")
|
||||
},
|
||||
{
|
||||
name: "delay",
|
||||
type: { name: "number", min: 0 },
|
||||
defaultValue: 0,
|
||||
description: gcli.lookup("screenshotDelayDesc"),
|
||||
manual: gcli.lookup("screenshotDelayManual")
|
||||
},
|
||||
{
|
||||
name: "fullpage",
|
||||
type: "boolean",
|
||||
description: gcli.lookup("screenshotFullPageDesc"),
|
||||
manual: gcli.lookup("screenshotFullPageManual")
|
||||
},
|
||||
{
|
||||
name: "selector",
|
||||
type: "node",
|
||||
defaultValue: null,
|
||||
description: gcli.lookup("inspectNodeDesc"),
|
||||
manual: gcli.lookup("inspectNodeManual")
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
exec: function Command_screenshot(args, context) {
|
||||
var document = context.environment.contentDocument;
|
||||
if (args.chrome && args.selector) {
|
||||
// Node screenshot with chrome option does not work as inteded
|
||||
// Refer https://bugzilla.mozilla.org/show_bug.cgi?id=659268#c7
|
||||
// throwing for now.
|
||||
throw new Error(gcli.lookup("screenshotSelectorChromeConflict"));
|
||||
}
|
||||
var document = args.chrome? context.environment.chromeDocument
|
||||
: context.environment.contentDocument;
|
||||
if (args.delay > 0) {
|
||||
var promise = context.createPromise();
|
||||
document.defaultView.setTimeout(function Command_screenshotDelay() {
|
||||
let reply = this.grabScreen(document, args.filename);
|
||||
let reply = this.grabScreen(document, args.filename, args.clipboard,
|
||||
args.fullpage);
|
||||
promise.resolve(reply);
|
||||
}.bind(this), args.delay * 1000);
|
||||
return promise;
|
||||
}
|
||||
else {
|
||||
return this.grabScreen(document, args.filename, args.fullpage, args.selector);
|
||||
return this.grabScreen(document, args.filename, args.clipboard,
|
||||
args.fullpage, args.selector);
|
||||
}
|
||||
},
|
||||
grabScreen:
|
||||
function Command_screenshotGrabScreen(document, filename, fullpage, node) {
|
||||
function Command_screenshotGrabScreen(document, filename, clipboard,
|
||||
fullpage, node) {
|
||||
let window = document.defaultView;
|
||||
let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
|
||||
let left = 0;
|
||||
let top = 0;
|
||||
let width;
|
||||
let height;
|
||||
let div = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
|
||||
|
||||
if (!fullpage) {
|
||||
if (!node) {
|
||||
@ -93,19 +126,70 @@ gcli.addCommand({
|
||||
|
||||
let ctx = canvas.getContext("2d");
|
||||
ctx.drawWindow(window, left, top, width, height, "#fff");
|
||||
|
||||
let data = canvas.toDataURL("image/png", "");
|
||||
|
||||
try {
|
||||
if (clipboard) {
|
||||
let io = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
let channel = io.newChannel(data, null, null);
|
||||
let input = channel.open();
|
||||
let imgTools = Cc["@mozilla.org/image/tools;1"]
|
||||
.getService(Ci.imgITools);
|
||||
|
||||
let container = {};
|
||||
imgTools.decodeImageData(input, channel.contentType, container);
|
||||
|
||||
let wrapped = Cc["@mozilla.org/supports-interface-pointer;1"]
|
||||
.createInstance(Ci.nsISupportsInterfacePointer);
|
||||
wrapped.data = container.value;
|
||||
|
||||
let trans = Cc["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Ci.nsITransferable);
|
||||
if ("init" in trans) {
|
||||
trans.init(null);
|
||||
}
|
||||
trans.addDataFlavor(channel.contentType);
|
||||
trans.setTransferData(channel.contentType, wrapped, -1);
|
||||
|
||||
let clipid = Ci.nsIClipboard;
|
||||
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
|
||||
clip.setData(trans, null, clipid.kGlobalClipboard);
|
||||
div.textContent = gcli.lookup("screenshotCopied");
|
||||
return div;
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
div.textContent = gcli.lookup("screenshotErrorCopying");
|
||||
return div;
|
||||
}
|
||||
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
|
||||
|
||||
// Create a name for the file if not present
|
||||
if (filename == FILENAME_DEFAULT_VALUE) {
|
||||
let date = new Date();
|
||||
let dateString = date.getFullYear() + "-" + (date.getMonth() + 1) +
|
||||
"-" + date.getDate();
|
||||
dateString = dateString.split("-").map(function(part) {
|
||||
if (part.length == 1) {
|
||||
part = "0" + part;
|
||||
}
|
||||
return part;
|
||||
}).join("-");
|
||||
let timeString = date.toTimeString().replace(/:/g, ".").split(" ")[0];
|
||||
filename = gcli.lookupFormat("screenshotGeneratedFilename",
|
||||
[dateString, timeString]) + ".png";
|
||||
}
|
||||
// Check there is a .png extension to filename
|
||||
if (!filename.match(/.png$/i)) {
|
||||
else if (!filename.match(/.png$/i)) {
|
||||
filename += ".png";
|
||||
}
|
||||
|
||||
// If the filename is relative, tack it onto the download directory
|
||||
if (!filename.match(/[\\\/]/)) {
|
||||
let downloadMgr = Cc["@mozilla.org/download-manager;1"]
|
||||
.getService(Ci.nsIDownloadManager);
|
||||
.getService(Ci.nsIDownloadManager);
|
||||
let tempfile = downloadMgr.userDownloadsDirectory;
|
||||
tempfile.append(filename);
|
||||
filename = tempfile.path;
|
||||
@ -114,21 +198,36 @@ gcli.addCommand({
|
||||
try {
|
||||
file.initWithPath(filename);
|
||||
} catch (ex) {
|
||||
return "Error saving to " + filename;
|
||||
div.textContent = gcli.lookup("screenshotErrorSavingToFile") + " " + filename;
|
||||
return div;
|
||||
}
|
||||
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
.getService(Ci.nsIIOService);
|
||||
|
||||
let Persist = Ci.nsIWebBrowserPersist;
|
||||
let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
|
||||
.createInstance(Persist);
|
||||
.createInstance(Persist);
|
||||
persist.persistFlags = Persist.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
|
||||
Persist.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
|
||||
|
||||
let source = ioService.newURI(data, "UTF8", null);
|
||||
persist.saveURI(source, null, null, null, null, file);
|
||||
|
||||
return "Saved to " + filename;
|
||||
div.textContent = gcli.lookup("screenshotSavedToFile") + " " + filename;
|
||||
div.addEventListener("click", function openFile() {
|
||||
div.removeEventListener("click", openFile);
|
||||
file.reveal();
|
||||
});
|
||||
div.style.cursor = "pointer";
|
||||
let image = document.createElement("div");
|
||||
let previewHeight = parseInt(256*height/width);
|
||||
image.setAttribute("style",
|
||||
"width:256px; height:" + previewHeight + "px;" +
|
||||
"background-image: url('" + data + "');" +
|
||||
"background-size: 256px " + previewHeight + "px;" +
|
||||
"margin: 4px; display: block");
|
||||
div.appendChild(image);
|
||||
return div;
|
||||
}
|
||||
});
|
||||
});
|
@ -24,6 +24,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_cmd_pagemod_export.js \
|
||||
browser_cmd_pref.js \
|
||||
browser_cmd_restart.js \
|
||||
browser_cmd_screenshot.js \
|
||||
browser_cmd_settings.js \
|
||||
browser_gcli_web.js \
|
||||
head.js \
|
||||
@ -33,6 +34,7 @@ MOCHITEST_BROWSER_FILES = \
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_dbg_cmd_break.html \
|
||||
browser_dbg_cmd.html \
|
||||
browser_cmd_screenshot.html \
|
||||
browser_cmd_pagemod_export.html \
|
||||
browser_cmd_jsb_script.jsi \
|
||||
$(NULL)
|
||||
|
@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<img id="testImage" ></img>
|
||||
</body>
|
||||
</html>
|
148
browser/devtools/commandline/test/browser_cmd_screenshot.js
Normal file
148
browser/devtools/commandline/test/browser_cmd_screenshot.js
Normal file
@ -0,0 +1,148 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test that screenshot command works properly
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/commandline/" +
|
||||
"test/browser_cmd_screenshot.html";
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
let tempScope = {};
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm", tempScope);
|
||||
let FileUtils = tempScope.FileUtils;
|
||||
|
||||
function test() {
|
||||
DeveloperToolbarTest.test(TEST_URI, [ testInput, testCapture ]);
|
||||
}
|
||||
|
||||
function testInput() {
|
||||
helpers.setInput('screenshot');
|
||||
helpers.check({
|
||||
input: 'screenshot',
|
||||
markup: 'VVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
}
|
||||
});
|
||||
|
||||
helpers.setInput('screenshot abc.png');
|
||||
helpers.check({
|
||||
input: 'screenshot abc.png',
|
||||
markup: 'VVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
filename: { value: "abc.png"},
|
||||
}
|
||||
});
|
||||
|
||||
helpers.setInput('screenshot --fullpage');
|
||||
helpers.check({
|
||||
input: 'screenshot --fullpage',
|
||||
markup: 'VVVVVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
fullpage: { value: true},
|
||||
}
|
||||
});
|
||||
|
||||
helpers.setInput('screenshot abc --delay 5');
|
||||
helpers.check({
|
||||
input: 'screenshot abc --delay 5',
|
||||
markup: 'VVVVVVVVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
filename: { value: "abc"},
|
||||
delay: { value: "5"},
|
||||
}
|
||||
});
|
||||
|
||||
helpers.setInput('screenshot --selector img#testImage');
|
||||
helpers.check({
|
||||
input: 'screenshot --selector img#testImage',
|
||||
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
selector: { value: content.document.getElementById("testImage")},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testCapture() {
|
||||
function checkTemporaryFile() {
|
||||
// Create a temporary file.
|
||||
let gFile = FileUtils.getFile("TmpD", ["TestScreenshotFile.png"]);
|
||||
if (gFile.exists()) {
|
||||
gFile.remove(false);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function clearClipboard() {
|
||||
let clipid = Ci.nsIClipboard;
|
||||
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
|
||||
clip.emptyClipboard(clipid.kGlobalClipboard);
|
||||
}
|
||||
|
||||
function checkClipboard() {
|
||||
try {
|
||||
let clipid = Ci.nsIClipboard;
|
||||
let clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid);
|
||||
let trans = Cc["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Ci.nsITransferable);
|
||||
if ("init" in trans) {
|
||||
trans.init(null);
|
||||
}
|
||||
let io = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService);
|
||||
let contentType = io.newChannel("", null, null).contentType;
|
||||
trans.addDataFlavor(contentType);
|
||||
clip.getData(trans, clipid.kGlobalClipboard);
|
||||
let str = new Object();
|
||||
let strLength = new Object();
|
||||
trans.getTransferData(contentType, str, strLength);
|
||||
if (str && strLength > 0) {
|
||||
clip.emptyClipboard(clipid.kGlobalClipboard);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (ex) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
let path = FileUtils.getFile("TmpD", ["TestScreenshotFile.png"]).path;
|
||||
|
||||
DeveloperToolbarTest.exec({
|
||||
typed: "screenshot " + path,
|
||||
args: {
|
||||
delay: 0,
|
||||
filename: "" + path,
|
||||
fullpage: false,
|
||||
clipboard: false,
|
||||
node: null,
|
||||
chrome: false,
|
||||
},
|
||||
outputMatch: new RegExp("^Saved to "),
|
||||
});
|
||||
|
||||
ok(checkTemporaryFile, "Screenshot got created");
|
||||
|
||||
clearClipboard();
|
||||
|
||||
DeveloperToolbarTest.exec({
|
||||
typed: "screenshot --fullpage --clipboard",
|
||||
args: {
|
||||
delay: 0,
|
||||
filename: " ",
|
||||
fullpage: true,
|
||||
clipboard: true,
|
||||
node: null,
|
||||
chrome: false,
|
||||
},
|
||||
outputMatch: new RegExp("^Copied to clipboard.$"),
|
||||
});
|
||||
|
||||
ok(checkClipboard, "Screenshot got created and copied");
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ DebuggerPane.prototype = {
|
||||
_initServer: function DP__initServer() {
|
||||
if (!DebuggerServer.initialized) {
|
||||
// Always allow connections from nsIPipe transports.
|
||||
DebuggerServer.init(function () { return true; });
|
||||
DebuggerServer.init(function() true);
|
||||
DebuggerServer.addBrowserActors();
|
||||
}
|
||||
},
|
||||
|
@ -248,23 +248,6 @@ let DebuggerController = {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if this is a remote debugger instance.
|
||||
* @return boolean
|
||||
*/
|
||||
get _isRemoteDebugger() {
|
||||
return window._remoteFlag;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if this is a chrome debugger instance.
|
||||
* @return boolean
|
||||
*/
|
||||
get _isChromeDebugger() {
|
||||
// Directly accessing window.parent.content may throw in some cases.
|
||||
return !("content" in window.parent) && !this._isRemoteDebugger;
|
||||
},
|
||||
|
||||
/**
|
||||
* Attempts to quit the current process if allowed.
|
||||
*/
|
||||
@ -297,6 +280,26 @@ let DebuggerController = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if this is a remote debugger instance.
|
||||
* @return boolean
|
||||
*/
|
||||
XPCOMUtils.defineLazyGetter(DebuggerController, "_isRemoteDebugger", function() {
|
||||
// We're inside a single top level XUL window, not an iframe container.
|
||||
return !(window.frameElement instanceof XULElement) &&
|
||||
!!window._remoteFlag;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns true if this is a chrome debugger instance.
|
||||
* @return boolean
|
||||
*/
|
||||
XPCOMUtils.defineLazyGetter(DebuggerController, "_isChromeDebugger", function() {
|
||||
// We're inside a single top level XUL window, but not a remote debugger.
|
||||
return !(window.frameElement instanceof XULElement) &&
|
||||
!window._remoteFlag;
|
||||
});
|
||||
|
||||
/**
|
||||
* ThreadState keeps the UI up to date with the state of the
|
||||
* thread (paused/attached/etc.).
|
||||
|
@ -59,9 +59,12 @@ let DebuggerView = {
|
||||
this._stepInButton = document.getElementById("step-in");
|
||||
this._stepOutButton = document.getElementById("step-out");
|
||||
this._scriptsSearchbox = document.getElementById("scripts-search");
|
||||
this._globalOperatorButton = document.getElementById("global-operator");
|
||||
this._tokenOperatorButton = document.getElementById("token-operator");
|
||||
this._lineOperatorButton = document.getElementById("line-operator");
|
||||
this._globalOperatorLabel = document.getElementById("global-operator-label");
|
||||
this._globalOperatorButton = document.getElementById("global-operator-button");
|
||||
this._tokenOperatorLabel = document.getElementById("token-operator-label");
|
||||
this._tokenOperatorButton = document.getElementById("token-operator-button");
|
||||
this._lineOperatorLabel = document.getElementById("line-operator-label");
|
||||
this._lineOperatorButton = document.getElementById("line-operator-button");
|
||||
},
|
||||
|
||||
/**
|
||||
@ -79,12 +82,16 @@ let DebuggerView = {
|
||||
|
||||
this._scriptsSearchbox.setAttribute("placeholder",
|
||||
L10N.getFormatStr("emptyFilterText", [LayoutHelpers.prettyKey(this._fileSearchKey)]));
|
||||
this._globalOperatorButton.setAttribute("value",
|
||||
this._globalOperatorLabel.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelGlobal", [LayoutHelpers.prettyKey(this._globalSearchKey)]));
|
||||
this._tokenOperatorButton.setAttribute("value",
|
||||
this._tokenOperatorLabel.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelToken", [LayoutHelpers.prettyKey(this._tokenSearchKey)]));
|
||||
this._lineOperatorButton.setAttribute("value",
|
||||
this._lineOperatorLabel.setAttribute("value",
|
||||
L10N.getFormatStr("searchPanelLine", [LayoutHelpers.prettyKey(this._lineSearchKey)]));
|
||||
|
||||
this._globalOperatorButton.setAttribute("label", SEARCH_GLOBAL_FLAG);
|
||||
this._tokenOperatorButton.setAttribute("label", SEARCH_TOKEN_FLAG);
|
||||
this._lineOperatorButton.setAttribute("label", SEARCH_LINE_FLAG);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -255,8 +262,11 @@ let DebuggerView = {
|
||||
_stepInButton: null,
|
||||
_stepOutButton: null,
|
||||
_scriptsSearchbox: null,
|
||||
_globalOperatorLabel: null,
|
||||
_globalOperatorButton: null,
|
||||
_tokenOperatorLabel: null,
|
||||
_tokenOperatorButton: null,
|
||||
_lineOperatorLabel: null,
|
||||
_lineOperatorButton: null
|
||||
};
|
||||
|
||||
|
@ -105,19 +105,19 @@
|
||||
<vbox>
|
||||
<label class="description" value="&debuggerUI.searchPanelTitle;"/>
|
||||
<hbox align="center">
|
||||
<button class="operator" label="!"
|
||||
<button id="global-operator-button" class="operator"
|
||||
onclick="DebuggerView.Scripts._onGlobalSearch()"/>
|
||||
<label id="global-operator" class="plain operator"/>
|
||||
<label id="global-operator-label" class="plain operator"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<button class="operator" label="#"
|
||||
<button id="token-operator-button" class="operator"
|
||||
onclick="DebuggerView.Scripts._onTokenSearch()"/>
|
||||
<label id="token-operator" class="plain operator"/>
|
||||
<label id="token-operator-label" class="plain operator"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<button class="operator" label=":"
|
||||
<button id="line-operator-button" class="operator"
|
||||
onclick="DebuggerView.Scripts._onLineSearch()"/>
|
||||
<label id="line-operator" class="plain operator"/>
|
||||
<label id="line-operator-label" class="plain operator"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</panel>
|
||||
|
@ -16,9 +16,7 @@ function test() {
|
||||
ok(pane, "toggleDebugger() should return a pane.");
|
||||
let frame = pane._frame;
|
||||
|
||||
frame.addEventListener("Debugger:Loaded", function dbgLoaded() {
|
||||
frame.removeEventListener("Debugger:Loaded", dbgLoaded, true);
|
||||
|
||||
wait_for_connect_and_resume(function() {
|
||||
let cmd = document.getElementById("Tools:Debugger");
|
||||
is(cmd.getAttribute("checked"), "true", "<command Tools:Debugger> is checked.");
|
||||
|
||||
@ -33,10 +31,10 @@ function test() {
|
||||
let pane = DebuggerUI.toggleDebugger();
|
||||
|
||||
is(cmd.getAttribute("checked"), "false", "<command Tools:Debugger> is unchecked once closed.");
|
||||
}, true);
|
||||
});
|
||||
|
||||
frame.addEventListener("Debugger:Unloaded", function dbgUnloaded() {
|
||||
frame.removeEventListener("Debugger:Unloaded", dbgUnloaded, true);
|
||||
window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
|
||||
window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
|
||||
removeTab(tab1);
|
||||
removeTab(tab2);
|
||||
|
||||
@ -45,4 +43,3 @@ function test() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,11 @@ function test() {
|
||||
is(DebuggerUI.getDebugger(), pane,
|
||||
"getDebugger() should return the same pane as toggleDebugger().");
|
||||
|
||||
let frame = pane._frame;
|
||||
let content = pane.contentWindow;
|
||||
let stackframes;
|
||||
let variables;
|
||||
|
||||
frame.addEventListener("Debugger:Loaded", function dbgLoaded() {
|
||||
frame.removeEventListener("Debugger:Loaded", dbgLoaded, true);
|
||||
|
||||
wait_for_connect_and_resume(function() {
|
||||
ok(content.Prefs.stackframesWidth,
|
||||
"The debugger preferences should have a saved stackframesWidth value.");
|
||||
ok(content.Prefs.variablesWidth,
|
||||
@ -45,11 +42,10 @@ function test() {
|
||||
variables.setAttribute("width", someWidth2);
|
||||
|
||||
removeTab(tab1);
|
||||
});
|
||||
|
||||
}, true);
|
||||
|
||||
frame.addEventListener("Debugger:Unloaded", function dbgUnloaded() {
|
||||
frame.removeEventListener("Debugger:Unloaded", dbgUnloaded, true);
|
||||
window.addEventListener("Debugger:Shutdown", function dbgShutdown() {
|
||||
window.removeEventListener("Debugger:Shutdown", dbgShutdown, true);
|
||||
|
||||
is(content.Prefs.stackframesWidth, stackframes.getAttribute("width"),
|
||||
"The stackframes pane width should have been saved by now.");
|
||||
|
@ -60,6 +60,30 @@ screenshotFilenameDesc=Destination filename
|
||||
# asks for help on what it does.
|
||||
screenshotFilenameManual=The name of the file (should have a '.png' extension) to which we write the screenshot.
|
||||
|
||||
# LOCALIZATION NOTE (screenshotClipboardDesc) A very short string to describe
|
||||
# the 'clipboard' parameter to the 'screenshot' command, which is displayed in
|
||||
# a dialog when the user is using this command.
|
||||
screenshotClipboardDesc=Copy screenshot to clipboard? (true/false)
|
||||
|
||||
# LOCALIZATION NOTE (screenshotClipboardManual) A fuller description of the
|
||||
# 'clipboard' parameter to the 'screenshot' command, displayed when the user
|
||||
# asks for help on what it does.
|
||||
screenshotClipboardManual=True if you want to copy the screenshot instead of saving it to a file.
|
||||
|
||||
# LOCALIZATION NOTE (screenshotChromeDesc) A very short string to describe
|
||||
# the 'chrome' parameter to the 'screenshot' command, which is displayed in
|
||||
# a dialog when the user is using this command.
|
||||
screenshotChromeDesc=Capture Firefox chrome window? (true/false)
|
||||
|
||||
# LOCALIZATION NOTE (screenshotChromeManual) A fuller description of the
|
||||
# 'chrome' parameter to the 'screenshot' command, displayed when the user
|
||||
# asks for help on what it does.
|
||||
screenshotChromeManual=True if you want to take the screenshot of the Firefox window rather than the web page's content window.
|
||||
|
||||
# LOCALIZATION NOTE (screenshotGroupOptions) A label for the optional options of
|
||||
# the screenshot command.
|
||||
screenshotGroupOptions=Options
|
||||
|
||||
# LOCALIZATION NOTE (screenshotDelayDesc) A very short string to describe
|
||||
# the 'delay' parameter to the 'screenshot' command, which is displayed in
|
||||
# a dialog when the user is using this command.
|
||||
@ -80,6 +104,33 @@ screenshotFullPageDesc=Entire webpage? (true/false)
|
||||
# asks for help on what it does.
|
||||
screenshotFullPageManual=True if the screenshot should also include parts of the webpage which are outside the current scrolled bounds.
|
||||
|
||||
# LOCALIZATION NOTE (screenshotSelectorChromeConflict) Exception thwon when user
|
||||
# tries to use 'selector' option along with 'chrome' option of the screenshot
|
||||
# command. Refer: https://bugzilla.mozilla.org/show_bug.cgi?id=659268#c7
|
||||
screenshotSelectorChromeConflict=selector option is not supported when chrome option is true
|
||||
|
||||
# LOCALIZATION NOTE (screenshotGeneratedFilename) The auto generated filename
|
||||
# when no file name is provided. the first argument (%1$S) is the date string
|
||||
# in yyyy-mm-dd format and the second argument (%2$S) is the time string
|
||||
# in HH.MM.SS format. Please don't add the extension here.
|
||||
screenshotGeneratedFilename=Screen Shot %1$S at %2$S
|
||||
|
||||
# LOCALIZATION NOTE (screenshotErrorSavingToFile) Text displayed to user upon
|
||||
# encountering error while saving the screenshot to the file specified.
|
||||
screenshotErrorSavingToFile=Error saving to
|
||||
|
||||
# LOCALIZATION NOTE (screenshotSavedToFile) Text displayed to user when the
|
||||
# screenshot is successfully saved to the file specified.
|
||||
screenshotSavedToFile=Saved to
|
||||
|
||||
# LOCALIZATION NOTE (screenshotErrorCopying) Text displayed to user upon
|
||||
# encountering error while copying the screenshot to clipboard.
|
||||
screenshotErrorCopying=Error occurred while copying to clipboard.
|
||||
|
||||
# LOCALIZATION NOTE (screenshotCopied) Text displayed to user when the
|
||||
# screenshot is successfully copied to the clipboard.
|
||||
screenshotCopied=Copied to clipboard.
|
||||
|
||||
# LOCALIZATION NOTE (restartFirefoxDesc) A very short description of the
|
||||
# 'restart' command. This string is designed to be shown in a menu alongside the
|
||||
# command name, which is why it should be as short as possible.
|
||||
|
@ -623,7 +623,8 @@ let LinkChecker = {
|
||||
_cache: {},
|
||||
|
||||
get flags() {
|
||||
return Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
|
||||
return Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL |
|
||||
Ci.nsIScriptSecurityManager.DONT_REPORT_ERRORS;
|
||||
},
|
||||
|
||||
checkLoadURI: function LinkChecker_checkLoadURI(aURI) {
|
||||
|
@ -10,7 +10,7 @@ interface nsIURI;
|
||||
interface nsIChannel;
|
||||
interface nsIDocShell;
|
||||
|
||||
[scriptable, uuid(75a7afe3-d7c9-46fe-b305-ae686457bc7f)]
|
||||
[scriptable, uuid(51289544-fd8a-11e1-8017-5abf937d8bec)]
|
||||
interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
{
|
||||
///////////////// Security Checks //////////////////
|
||||
@ -71,6 +71,10 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||
// DISALLOW_INHERIT_PRINCIPAL
|
||||
const unsigned long DISALLOW_SCRIPT = 1 << 3;
|
||||
|
||||
// Do not report errors if we just want to check if a principal can load
|
||||
// a URI to not unnecessarily spam the error console.
|
||||
const unsigned long DONT_REPORT_ERRORS = 1 << 4;
|
||||
|
||||
/**
|
||||
* Check that content with principal aPrincipal can load "uri".
|
||||
*
|
||||
|
@ -1306,7 +1306,8 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
NS_ENSURE_FALSE(aFlags & ~(nsIScriptSecurityManager::LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT |
|
||||
nsIScriptSecurityManager::ALLOW_CHROME |
|
||||
nsIScriptSecurityManager::DISALLOW_SCRIPT |
|
||||
nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL),
|
||||
nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL |
|
||||
nsIScriptSecurityManager::DONT_REPORT_ERRORS),
|
||||
NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_ARG_POINTER(aPrincipal);
|
||||
NS_ENSURE_ARG_POINTER(aTargetURI);
|
||||
@ -1374,6 +1375,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(errorTag, "CheckLoadURIError");
|
||||
bool reportErrors = !(aFlags & nsIScriptSecurityManager::DONT_REPORT_ERRORS);
|
||||
|
||||
// Check for uris that are only loadable by principals that subsume them
|
||||
bool hasFlags;
|
||||
@ -1417,7 +1419,9 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
nsIProtocolHandler::URI_DANGEROUS_TO_LOAD);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Deny access, since the origin principal is not system
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
if (reportErrors) {
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1456,7 +1460,9 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
if (sourceIsChrome) {
|
||||
return NS_OK;
|
||||
}
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
if (reportErrors) {
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
}
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
@ -1492,7 +1498,9 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
if (reportErrors) {
|
||||
ReportError(nullptr, errorTag, sourceURI, aTargetURI);
|
||||
}
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,10 @@ class B2GXPCShellRemote(XPCShellRemote):
|
||||
|
||||
# Overridden
|
||||
def setupUtilities(self):
|
||||
# Ensure a fresh directory structure for our tests
|
||||
self.clean()
|
||||
self.device.mkDir(DEVICE_TEST_ROOT)
|
||||
if self.options.clean:
|
||||
# Ensure a fresh directory structure for our tests
|
||||
self.clean()
|
||||
self.device.mkDir(DEVICE_TEST_ROOT)
|
||||
|
||||
XPCShellRemote.setupUtilities(self)
|
||||
|
||||
@ -70,6 +71,12 @@ class B2GOptions(RemoteXPCShellOptions):
|
||||
type='string', dest='emu_path',
|
||||
help="Path to emulator folder (if different "
|
||||
"from b2gpath")
|
||||
|
||||
self.add_option('--no-clean', action='store_false',
|
||||
dest='clean',
|
||||
help="Do not clean TESTROOT. Saves [lots of] time")
|
||||
defaults['clean'] = True
|
||||
|
||||
defaults['emu_path'] = None
|
||||
|
||||
self.add_option('--emulator', action='store',
|
||||
|
Loading…
Reference in New Issue
Block a user