зеркало из https://github.com/mozilla/pjs.git
merge m-c to fx-team
This commit is contained in:
Коммит
27ba7a882f
|
@ -872,7 +872,7 @@ pref("browser.zoom.updateBackgroundTabs", true);
|
||||||
pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
|
pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
|
||||||
|
|
||||||
// base URL for web-based support pages
|
// base URL for web-based support pages
|
||||||
pref("app.support.baseURL", "http://support.mozilla.com/1/firefox/%VERSION%/%OS%/%LOCALE%/");
|
pref("app.support.baseURL", "http://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/");
|
||||||
|
|
||||||
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
|
// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
|
||||||
pref("security.alternate_certificate_error_page", "certerror");
|
pref("security.alternate_certificate_error_page", "certerror");
|
||||||
|
|
|
@ -3935,13 +3935,10 @@ var FullScreen = {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The user may quit fullscreen during an animation
|
// The user may quit fullscreen during an animation
|
||||||
window.mozCancelAnimationFrame(this._animationHandle);
|
this._cancelAnimation();
|
||||||
this._animationHandle = 0;
|
|
||||||
clearTimeout(this._animationTimeout);
|
|
||||||
gNavToolbox.style.marginTop = "";
|
gNavToolbox.style.marginTop = "";
|
||||||
if (this._isChromeCollapsed)
|
if (this._isChromeCollapsed)
|
||||||
this.mouseoverToggle(true);
|
this.mouseoverToggle(true);
|
||||||
this._isAnimating = false;
|
|
||||||
// This is needed if they use the context menu to quit fullscreen
|
// This is needed if they use the context menu to quit fullscreen
|
||||||
this._isPopupOpen = false;
|
this._isPopupOpen = false;
|
||||||
|
|
||||||
|
@ -4002,10 +3999,7 @@ var FullScreen = {
|
||||||
|
|
||||||
// Cancel any "hide the toolbar" animation which is in progress, and make
|
// Cancel any "hide the toolbar" animation which is in progress, and make
|
||||||
// the toolbar hide immediately.
|
// the toolbar hide immediately.
|
||||||
clearInterval(this._animationInterval);
|
this._cancelAnimation();
|
||||||
clearTimeout(this._animationTimeout);
|
|
||||||
this._isAnimating = false;
|
|
||||||
this._shouldAnimate = false;
|
|
||||||
this.mouseoverToggle(false);
|
this.mouseoverToggle(false);
|
||||||
|
|
||||||
// If there's a full-screen toggler, remove its listeners, so that mouseover
|
// If there's a full-screen toggler, remove its listeners, so that mouseover
|
||||||
|
@ -4150,11 +4144,8 @@ var FullScreen = {
|
||||||
|
|
||||||
if (pos >= 1) {
|
if (pos >= 1) {
|
||||||
// We've animated enough
|
// We've animated enough
|
||||||
window.mozCancelAnimationFrame(this._animationHandle);
|
this._cancelAnimation();
|
||||||
gNavToolbox.style.marginTop = "";
|
gNavToolbox.style.marginTop = "";
|
||||||
this._animationHandle = 0;
|
|
||||||
this._isAnimating = false;
|
|
||||||
this._shouldAnimate = false; // Just to make sure
|
|
||||||
this.mouseoverToggle(false);
|
this.mouseoverToggle(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4163,6 +4154,14 @@ var FullScreen = {
|
||||||
this._animationHandle = window.mozRequestAnimationFrame(this);
|
this._animationHandle = window.mozRequestAnimationFrame(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_cancelAnimation: function() {
|
||||||
|
window.mozCancelAnimationFrame(this._animationHandle);
|
||||||
|
this._animationHandle = 0;
|
||||||
|
clearTimeout(this._animationTimeout);
|
||||||
|
this._isAnimating = false;
|
||||||
|
this._shouldAnimate = false;
|
||||||
|
},
|
||||||
|
|
||||||
cancelWarning: function(event) {
|
cancelWarning: function(event) {
|
||||||
if (!this.warningBox) {
|
if (!this.warningBox) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -119,12 +119,29 @@ XPCOMUtils.defineLazyGetter(this, "AutocompletePopup", function () {
|
||||||
return obj.AutocompletePopup;
|
return obj.AutocompletePopup;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "ScratchpadManager", function () {
|
||||||
|
var obj = {};
|
||||||
|
try {
|
||||||
|
Cu.import("resource:///modules/devtools/scratchpad-manager.jsm", obj);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
Cu.reportError(err);
|
||||||
|
}
|
||||||
|
return obj.ScratchpadManager;
|
||||||
|
});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "namesAndValuesOf", function () {
|
XPCOMUtils.defineLazyGetter(this, "namesAndValuesOf", function () {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
Cu.import("resource:///modules/PropertyPanel.jsm", obj);
|
Cu.import("resource:///modules/PropertyPanel.jsm", obj);
|
||||||
return obj.namesAndValuesOf;
|
return obj.namesAndValuesOf;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "gConsoleStorage", function () {
|
||||||
|
let obj = {};
|
||||||
|
Cu.import("resource://gre/modules/ConsoleAPIStorage.jsm", obj);
|
||||||
|
return obj.ConsoleAPIStorage;
|
||||||
|
});
|
||||||
|
|
||||||
function LogFactory(aMessagePrefix)
|
function LogFactory(aMessagePrefix)
|
||||||
{
|
{
|
||||||
function log(aMessage) {
|
function log(aMessage) {
|
||||||
|
@ -1414,6 +1431,18 @@ HUD_SERVICE.prototype =
|
||||||
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ID of the inner window of this DOM window
|
||||||
|
*
|
||||||
|
* @param nsIDOMWindow aWindow
|
||||||
|
* @returns integer
|
||||||
|
*/
|
||||||
|
getInnerWindowId: function HS_getInnerWindowId(aWindow)
|
||||||
|
{
|
||||||
|
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||||
|
getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the top level content window that has an outer window with
|
* Gets the top level content window that has an outer window with
|
||||||
* the given ID or returns null if no such content window exists
|
* the given ID or returns null if no such content window exists
|
||||||
|
@ -2145,7 +2174,8 @@ HUD_SERVICE.prototype =
|
||||||
sourceURL,
|
sourceURL,
|
||||||
sourceLine,
|
sourceLine,
|
||||||
clipboardText,
|
clipboardText,
|
||||||
level);
|
level,
|
||||||
|
aMessage.timeStamp);
|
||||||
|
|
||||||
// Make the node bring up the property panel, to allow the user to inspect
|
// Make the node bring up the property panel, to allow the user to inspect
|
||||||
// the stack trace.
|
// the stack trace.
|
||||||
|
@ -2212,18 +2242,38 @@ HUD_SERVICE.prototype =
|
||||||
/**
|
/**
|
||||||
* Reports an error in the page source, either JavaScript or CSS.
|
* Reports an error in the page source, either JavaScript or CSS.
|
||||||
*
|
*
|
||||||
* @param number aCategory
|
|
||||||
* The category of the message; either CATEGORY_CSS or CATEGORY_JS.
|
|
||||||
* @param nsIScriptError aScriptError
|
* @param nsIScriptError aScriptError
|
||||||
* The error message to report.
|
* The error message to report.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
reportPageError: function HS_reportPageError(aCategory, aScriptError)
|
reportPageError: function HS_reportPageError(aScriptError)
|
||||||
{
|
{
|
||||||
if (aCategory != CATEGORY_CSS && aCategory != CATEGORY_JS) {
|
if (!aScriptError.outerWindowID) {
|
||||||
throw Components.Exception("Unsupported category (must be one of CSS " +
|
return;
|
||||||
"or JS)", Cr.NS_ERROR_INVALID_ARG,
|
}
|
||||||
Components.stack.caller);
|
|
||||||
|
let category;
|
||||||
|
|
||||||
|
switch (aScriptError.category) {
|
||||||
|
// We ignore chrome-originating errors as we only care about content.
|
||||||
|
case "XPConnect JavaScript":
|
||||||
|
case "component javascript":
|
||||||
|
case "chrome javascript":
|
||||||
|
case "chrome registration":
|
||||||
|
case "XBL":
|
||||||
|
case "XBL Prototype Handler":
|
||||||
|
case "XBL Content Sink":
|
||||||
|
case "xbl javascript":
|
||||||
|
return;
|
||||||
|
|
||||||
|
case "CSS Parser":
|
||||||
|
case "CSS Loader":
|
||||||
|
category = CATEGORY_CSS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
category = CATEGORY_JS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warnings and legacy strict errors become warnings; other types become
|
// Warnings and legacy strict errors become warnings; other types become
|
||||||
|
@ -2242,12 +2292,14 @@ HUD_SERVICE.prototype =
|
||||||
let chromeDocument = outputNode.ownerDocument;
|
let chromeDocument = outputNode.ownerDocument;
|
||||||
|
|
||||||
let node = ConsoleUtils.createMessageNode(chromeDocument,
|
let node = ConsoleUtils.createMessageNode(chromeDocument,
|
||||||
aCategory,
|
category,
|
||||||
severity,
|
severity,
|
||||||
aScriptError.errorMessage,
|
aScriptError.errorMessage,
|
||||||
hudId,
|
hudId,
|
||||||
aScriptError.sourceName,
|
aScriptError.sourceName,
|
||||||
aScriptError.lineNumber);
|
aScriptError.lineNumber,
|
||||||
|
null, null,
|
||||||
|
aScriptError.timeStamp);
|
||||||
|
|
||||||
ConsoleUtils.outputMessageNode(node, hudId);
|
ConsoleUtils.outputMessageNode(node, hudId);
|
||||||
}
|
}
|
||||||
|
@ -2895,7 +2947,7 @@ HUD_SERVICE.prototype =
|
||||||
if (!hudNode) {
|
if (!hudNode) {
|
||||||
// get nBox object and call new HUD
|
// get nBox object and call new HUD
|
||||||
let config = { parentNode: nBox,
|
let config = { parentNode: nBox,
|
||||||
contentWindow: aContentWindow
|
contentWindow: aContentWindow.top
|
||||||
};
|
};
|
||||||
|
|
||||||
hud = new HeadsUpDisplay(config);
|
hud = new HeadsUpDisplay(config);
|
||||||
|
@ -2908,6 +2960,8 @@ HUD_SERVICE.prototype =
|
||||||
|
|
||||||
_browser.webProgress.addProgressListener(hud.progressListener,
|
_browser.webProgress.addProgressListener(hud.progressListener,
|
||||||
Ci.nsIWebProgress.NOTIFY_STATE_ALL);
|
Ci.nsIWebProgress.NOTIFY_STATE_ALL);
|
||||||
|
|
||||||
|
hud.displayCachedConsoleMessages();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hud = this.hudReferences[hudId];
|
hud = this.hudReferences[hudId];
|
||||||
|
@ -3576,6 +3630,58 @@ HeadsUpDisplay.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display cached messages that may have been collected before the UI is
|
||||||
|
* displayed.
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
displayCachedConsoleMessages: function HUD_displayCachedConsoleMessages()
|
||||||
|
{
|
||||||
|
let innerWindowId = HUDService.getInnerWindowId(this.contentWindow);
|
||||||
|
|
||||||
|
let messages = gConsoleStorage.getEvents(innerWindowId);
|
||||||
|
|
||||||
|
let errors = {};
|
||||||
|
Services.console.getMessageArray(errors, {});
|
||||||
|
|
||||||
|
// Filter the errors to find only those we should display.
|
||||||
|
let filteredErrors = (errors.value || []).filter(function(aError) {
|
||||||
|
return aError instanceof Ci.nsIScriptError &&
|
||||||
|
aError.innerWindowID == innerWindowId;
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
messages.push.apply(messages, filteredErrors);
|
||||||
|
messages.sort(function(a, b) { return a.timeStamp - b.timeStamp; });
|
||||||
|
|
||||||
|
// Turn off scrolling for the moment.
|
||||||
|
ConsoleUtils.scroll = false;
|
||||||
|
this.outputNode.hidden = true;
|
||||||
|
|
||||||
|
// Display all messages.
|
||||||
|
messages.forEach(function(aMessage) {
|
||||||
|
if (aMessage instanceof Ci.nsIScriptError) {
|
||||||
|
HUDService.reportPageError(aMessage);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// In this case the cached message is a console message generated
|
||||||
|
// by the ConsoleAPI, not an nsIScriptError
|
||||||
|
HUDService.logConsoleAPIMessage(this.hudId, aMessage);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
this.outputNode.hidden = false;
|
||||||
|
ConsoleUtils.scroll = true;
|
||||||
|
|
||||||
|
// Scroll to bottom.
|
||||||
|
let numChildren = this.outputNode.childNodes.length;
|
||||||
|
if (numChildren && this.outputNode.clientHeight) {
|
||||||
|
// We also check the clientHeight to force a reflow, otherwise
|
||||||
|
// ensureIndexIsVisible() does not work after outputNode.hidden = false.
|
||||||
|
this.outputNode.ensureIndexIsVisible(numChildren - 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-attaches a console when the contentWindow is recreated
|
* Re-attaches a console when the contentWindow is recreated
|
||||||
*
|
*
|
||||||
|
@ -4008,7 +4114,7 @@ HeadsUpDisplay.prototype = {
|
||||||
function HUD_clearButton_onCommand() {
|
function HUD_clearButton_onCommand() {
|
||||||
let hud = HUDService.getHudReferenceById(hudId);
|
let hud = HUDService.getHudReferenceById(hudId);
|
||||||
if (hud.jsterm) {
|
if (hud.jsterm) {
|
||||||
hud.jsterm.clearOutput();
|
hud.jsterm.clearOutput(true);
|
||||||
}
|
}
|
||||||
if (hud.gcliterm) {
|
if (hud.gcliterm) {
|
||||||
hud.gcliterm.clearOutput();
|
hud.gcliterm.clearOutput();
|
||||||
|
@ -4526,7 +4632,7 @@ function JSTermHelper(aJSTerm)
|
||||||
aJSTerm.sandbox.clear = function JSTH_clear()
|
aJSTerm.sandbox.clear = function JSTH_clear()
|
||||||
{
|
{
|
||||||
aJSTerm.helperEvaluated = true;
|
aJSTerm.helperEvaluated = true;
|
||||||
aJSTerm.clearOutput();
|
aJSTerm.clearOutput(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5118,7 +5224,14 @@ JSTerm.prototype = {
|
||||||
return type.toLowerCase();
|
return type.toLowerCase();
|
||||||
},
|
},
|
||||||
|
|
||||||
clearOutput: function JST_clearOutput()
|
/**
|
||||||
|
* Clear the Web Console output.
|
||||||
|
*
|
||||||
|
* @param boolean aClearStorage
|
||||||
|
* True if you want to clear the console messages storage associated to
|
||||||
|
* this Web Console.
|
||||||
|
*/
|
||||||
|
clearOutput: function JST_clearOutput(aClearStorage)
|
||||||
{
|
{
|
||||||
let hud = HUDService.getHudReferenceById(this.hudId);
|
let hud = HUDService.getHudReferenceById(this.hudId);
|
||||||
hud.cssNodes = {};
|
hud.cssNodes = {};
|
||||||
|
@ -5136,6 +5249,11 @@ JSTerm.prototype = {
|
||||||
|
|
||||||
hud.HUDBox.lastTimestamp = 0;
|
hud.HUDBox.lastTimestamp = 0;
|
||||||
hud.groupDepth = 0;
|
hud.groupDepth = 0;
|
||||||
|
|
||||||
|
if (aClearStorage) {
|
||||||
|
let windowId = HUDService.getInnerWindowId(hud.contentWindow);
|
||||||
|
gConsoleStorage.clearEvents(windowId);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5666,6 +5784,11 @@ FirefoxApplicationHooks.prototype = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ConsoleUtils = {
|
ConsoleUtils = {
|
||||||
|
/**
|
||||||
|
* Flag to turn on and off scrolling.
|
||||||
|
*/
|
||||||
|
scroll: true,
|
||||||
|
|
||||||
supString: function ConsoleUtils_supString(aString)
|
supString: function ConsoleUtils_supString(aString)
|
||||||
{
|
{
|
||||||
let str = Cc["@mozilla.org/supports-string;1"].
|
let str = Cc["@mozilla.org/supports-string;1"].
|
||||||
|
@ -5709,6 +5832,10 @@ ConsoleUtils = {
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
scrollToVisible: function ConsoleUtils_scrollToVisible(aNode) {
|
scrollToVisible: function ConsoleUtils_scrollToVisible(aNode) {
|
||||||
|
if (!this.scroll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Find the enclosing richlistbox node.
|
// Find the enclosing richlistbox node.
|
||||||
let richListBoxNode = aNode.parentNode;
|
let richListBoxNode = aNode.parentNode;
|
||||||
while (richListBoxNode.tagName != "richlistbox") {
|
while (richListBoxNode.tagName != "richlistbox") {
|
||||||
|
@ -5746,6 +5873,9 @@ ConsoleUtils = {
|
||||||
* a string, then the clipboard text must be supplied.
|
* a string, then the clipboard text must be supplied.
|
||||||
* @param number aLevel [optional]
|
* @param number aLevel [optional]
|
||||||
* The level of the console API message.
|
* The level of the console API message.
|
||||||
|
* @param number aTimeStamp [optional]
|
||||||
|
* The timestamp to use for this message node. If omitted, the current
|
||||||
|
* date and time is used.
|
||||||
* @return nsIDOMNode
|
* @return nsIDOMNode
|
||||||
* The message node: a XUL richlistitem ready to be inserted into
|
* The message node: a XUL richlistitem ready to be inserted into
|
||||||
* the Web Console output node.
|
* the Web Console output node.
|
||||||
|
@ -5753,7 +5883,8 @@ ConsoleUtils = {
|
||||||
createMessageNode:
|
createMessageNode:
|
||||||
function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
|
function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
|
||||||
aBody, aHUDId, aSourceURL,
|
aBody, aHUDId, aSourceURL,
|
||||||
aSourceLine, aClipboardText, aLevel) {
|
aSourceLine, aClipboardText, aLevel,
|
||||||
|
aTimeStamp) {
|
||||||
if (typeof aBody != "string" && aClipboardText == null && aBody.innerText) {
|
if (typeof aBody != "string" && aClipboardText == null && aBody.innerText) {
|
||||||
aClipboardText = aBody.innerText;
|
aClipboardText = aBody.innerText;
|
||||||
}
|
}
|
||||||
|
@ -5813,7 +5944,7 @@ ConsoleUtils = {
|
||||||
// Create the timestamp.
|
// Create the timestamp.
|
||||||
let timestampNode = aDocument.createElementNS(XUL_NS, "label");
|
let timestampNode = aDocument.createElementNS(XUL_NS, "label");
|
||||||
timestampNode.classList.add("webconsole-timestamp");
|
timestampNode.classList.add("webconsole-timestamp");
|
||||||
let timestamp = ConsoleUtils.timestamp();
|
let timestamp = aTimeStamp || ConsoleUtils.timestamp();
|
||||||
let timestampString = ConsoleUtils.timestampString(timestamp);
|
let timestampString = ConsoleUtils.timestampString(timestamp);
|
||||||
timestampNode.setAttribute("value", timestampString);
|
timestampNode.setAttribute("value", timestampString);
|
||||||
|
|
||||||
|
@ -6519,48 +6650,22 @@ HUDConsoleObserver = {
|
||||||
init: function HCO_init()
|
init: function HCO_init()
|
||||||
{
|
{
|
||||||
Services.console.registerListener(this);
|
Services.console.registerListener(this);
|
||||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
Services.obs.addObserver(this, "quit-application-granted", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function HCO_uninit()
|
uninit: function HCO_uninit()
|
||||||
{
|
{
|
||||||
Services.console.unregisterListener(this);
|
Services.console.unregisterListener(this);
|
||||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
Services.obs.removeObserver(this, "quit-application-granted");
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function HCO_observe(aSubject, aTopic, aData)
|
observe: function HCO_observe(aSubject, aTopic, aData)
|
||||||
{
|
{
|
||||||
if (aTopic == "xpcom-shutdown") {
|
if (aTopic == "quit-application-granted") {
|
||||||
this.uninit();
|
this.uninit();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (aSubject instanceof Ci.nsIScriptError) {
|
||||||
if (!(aSubject instanceof Ci.nsIScriptError) ||
|
HUDService.reportPageError(aSubject);
|
||||||
!aSubject.outerWindowID) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (aSubject.category) {
|
|
||||||
// We ignore chrome-originating errors as we only
|
|
||||||
// care about content.
|
|
||||||
case "XPConnect JavaScript":
|
|
||||||
case "component javascript":
|
|
||||||
case "chrome javascript":
|
|
||||||
case "chrome registration":
|
|
||||||
case "XBL":
|
|
||||||
case "XBL Prototype Handler":
|
|
||||||
case "XBL Content Sink":
|
|
||||||
case "xbl javascript":
|
|
||||||
return;
|
|
||||||
|
|
||||||
case "CSS Parser":
|
|
||||||
case "CSS Loader":
|
|
||||||
HUDService.reportPageError(CATEGORY_CSS, aSubject);
|
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
|
||||||
HUDService.reportPageError(CATEGORY_JS, aSubject);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -6675,21 +6780,14 @@ function appName()
|
||||||
throw new Error("appName: UNSUPPORTED APPLICATION UUID");
|
throw new Error("appName: UNSUPPORTED APPLICATION UUID");
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
XPCOMUtils.defineLazyGetter(this, "HUDService", function () {
|
||||||
// HUDService (exported symbol)
|
try {
|
||||||
///////////////////////////////////////////////////////////////////////////
|
return new HUD_SERVICE();
|
||||||
|
}
|
||||||
try {
|
catch (ex) {
|
||||||
// start the HUDService
|
Cu.reportError(ex);
|
||||||
// This is in a try block because we want to kill everything if
|
}
|
||||||
// *any* of this fails
|
});
|
||||||
var HUDService = new HUD_SERVICE();
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
Cu.reportError("HUDService failed initialization.\n" + ex);
|
|
||||||
// TODO: kill anything that may have started up
|
|
||||||
// see bug 568665
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GcliTerm
|
// GcliTerm
|
||||||
|
@ -6732,6 +6830,20 @@ function GcliTerm(aContentWindow, aHudId, aDocument, aConsole, aHintNode, aConso
|
||||||
this.show = this.show.bind(this);
|
this.show = this.show.bind(this);
|
||||||
this.hide = this.hide.bind(this);
|
this.hide = this.hide.bind(this);
|
||||||
|
|
||||||
|
// Allow GCLI:Inputter to decide how and when to open a scratchpad window
|
||||||
|
let scratchpad = {
|
||||||
|
shouldActivate: function Scratchpad_shouldActivate(aEvent) {
|
||||||
|
return aEvent.shiftKey &&
|
||||||
|
aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_RETURN;
|
||||||
|
},
|
||||||
|
activate: function Scratchpad_activate(aValue) {
|
||||||
|
aValue = aValue.replace(/^\s*{\s*/, '');
|
||||||
|
ScratchpadManager.openScratchpad({ text: aValue });
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
linkText: stringBundle.GetStringFromName('scratchpad.linkText')
|
||||||
|
};
|
||||||
|
|
||||||
this.opts = {
|
this.opts = {
|
||||||
environment: { hudId: this.hudId },
|
environment: { hudId: this.hudId },
|
||||||
chromeDocument: this.document,
|
chromeDocument: this.document,
|
||||||
|
@ -6745,6 +6857,7 @@ function GcliTerm(aContentWindow, aHudId, aDocument, aConsole, aHintNode, aConso
|
||||||
inputBackgroundElement: this.inputStack,
|
inputBackgroundElement: this.inputStack,
|
||||||
hintElement: this.hintNode,
|
hintElement: this.hintNode,
|
||||||
consoleWrap: aConsoleWrap,
|
consoleWrap: aConsoleWrap,
|
||||||
|
scratchpad: scratchpad,
|
||||||
gcliTerm: this
|
gcliTerm: this
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5324,7 +5324,8 @@ define('gcli/ui/domtemplate', ['require', 'exports', 'module' ], function(requir
|
||||||
exports.template = obj.template;
|
exports.template = obj.template;
|
||||||
|
|
||||||
});
|
});
|
||||||
define("text!gcli/commands/help.css", [], void 0);
|
define("text!gcli/commands/help.css", [], "");
|
||||||
|
|
||||||
define("text!gcli/commands/help_intro.html", [], "\n" +
|
define("text!gcli/commands/help_intro.html", [], "\n" +
|
||||||
"<h2>${l10n.introHeader}</h2>\n" +
|
"<h2>${l10n.introHeader}</h2>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -5415,7 +5416,8 @@ function Console(options) {
|
||||||
completeElement: options.completeElement,
|
completeElement: options.completeElement,
|
||||||
completionPrompt: '',
|
completionPrompt: '',
|
||||||
backgroundElement: options.backgroundElement,
|
backgroundElement: options.backgroundElement,
|
||||||
focusManager: this.focusManager
|
focusManager: this.focusManager,
|
||||||
|
scratchpad: options.scratchpad
|
||||||
});
|
});
|
||||||
|
|
||||||
this.menu = new CommandMenu({
|
this.menu = new CommandMenu({
|
||||||
|
@ -5566,12 +5568,13 @@ exports.Console = Console;
|
||||||
* http://opensource.org/licenses/BSD-3-Clause
|
* http://opensource.org/licenses/BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('gcli/ui/inputter', ['require', 'exports', 'module' , 'gcli/util', 'gcli/types', 'gcli/history', 'text!gcli/ui/inputter.css'], function(require, exports, module) {
|
define('gcli/ui/inputter', ['require', 'exports', 'module' , 'gcli/util', 'gcli/l10n', 'gcli/types', 'gcli/history', 'text!gcli/ui/inputter.css'], function(require, exports, module) {
|
||||||
var cliView = exports;
|
var cliView = exports;
|
||||||
|
|
||||||
|
|
||||||
var KeyEvent = require('gcli/util').event.KeyEvent;
|
var KeyEvent = require('gcli/util').event.KeyEvent;
|
||||||
var dom = require('gcli/util').dom;
|
var dom = require('gcli/util').dom;
|
||||||
|
var l10n = require('gcli/l10n');
|
||||||
|
|
||||||
var Status = require('gcli/types').Status;
|
var Status = require('gcli/types').Status;
|
||||||
var History = require('gcli/history').History;
|
var History = require('gcli/history').History;
|
||||||
|
@ -5584,6 +5587,7 @@ var inputterCss = require('text!gcli/ui/inputter.css');
|
||||||
*/
|
*/
|
||||||
function Inputter(options) {
|
function Inputter(options) {
|
||||||
this.requisition = options.requisition;
|
this.requisition = options.requisition;
|
||||||
|
this.scratchpad = options.scratchpad;
|
||||||
|
|
||||||
// Suss out where the input element is
|
// Suss out where the input element is
|
||||||
this.element = options.inputElement || 'gcli-input';
|
this.element = options.inputElement || 'gcli-input';
|
||||||
|
@ -5865,6 +5869,14 @@ Inputter.prototype.onKeyDown = function(ev) {
|
||||||
* The main keyboard processing loop
|
* The main keyboard processing loop
|
||||||
*/
|
*/
|
||||||
Inputter.prototype.onKeyUp = function(ev) {
|
Inputter.prototype.onKeyUp = function(ev) {
|
||||||
|
// Give the scratchpad (if enabled) a chance to activate
|
||||||
|
if (this.scratchpad && this.scratchpad.shouldActivate(ev)) {
|
||||||
|
if (this.scratchpad.activate(this.element.value)) {
|
||||||
|
this._setInputInternal('', true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// RETURN does a special exec/highlight thing
|
// RETURN does a special exec/highlight thing
|
||||||
if (ev.keyCode === KeyEvent.DOM_VK_RETURN) {
|
if (ev.keyCode === KeyEvent.DOM_VK_RETURN) {
|
||||||
var worst = this.requisition.getStatus();
|
var worst = this.requisition.getStatus();
|
||||||
|
@ -5963,6 +5975,11 @@ Inputter.prototype.getInputState = function() {
|
||||||
console.log('fixing input.typed=""', input);
|
console.log('fixing input.typed=""', input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for a Bug 717268 (which is really a jsdom bug)
|
||||||
|
if (input.cursor.start == null) {
|
||||||
|
input.cursor.start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5986,6 +6003,7 @@ function Completer(options) {
|
||||||
this.document = options.document || document;
|
this.document = options.document || document;
|
||||||
this.requisition = options.requisition;
|
this.requisition = options.requisition;
|
||||||
this.elementCreated = false;
|
this.elementCreated = false;
|
||||||
|
this.scratchpad = options.scratchpad;
|
||||||
|
|
||||||
this.element = options.completeElement || 'gcli-row-complete';
|
this.element = options.completeElement || 'gcli-row-complete';
|
||||||
if (typeof this.element === 'string') {
|
if (typeof this.element === 'string') {
|
||||||
|
@ -6079,6 +6097,11 @@ Completer.prototype.decorate = function(inputter) {
|
||||||
* Ensure that the completion element is the same size and the inputter element
|
* Ensure that the completion element is the same size and the inputter element
|
||||||
*/
|
*/
|
||||||
Completer.prototype.resizer = function() {
|
Completer.prototype.resizer = function() {
|
||||||
|
// Remove this when jsdom does getBoundingClientRect(). See Bug 717269
|
||||||
|
if (!this.inputter.element.getBoundingClientRect) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var rect = this.inputter.element.getBoundingClientRect();
|
var rect = this.inputter.element.getBoundingClientRect();
|
||||||
// -4 to line up with 1px of padding and border, top and bottom
|
// -4 to line up with 1px of padding and border, top and bottom
|
||||||
var height = rect.bottom - rect.top - 4;
|
var height = rect.bottom - rect.top - 4;
|
||||||
|
@ -6123,6 +6146,7 @@ Completer.prototype.update = function(input) {
|
||||||
// ${prefix}
|
// ${prefix}
|
||||||
// <span class="gcli-in-ontab">${contents}</span>
|
// <span class="gcli-in-ontab">${contents}</span>
|
||||||
// <span class="gcli-in-closebrace" if="${unclosedJs}">}<span>
|
// <span class="gcli-in-closebrace" if="${unclosedJs}">}<span>
|
||||||
|
// <div class="gcli-in-scratchlink">${scratchLink}</div>
|
||||||
|
|
||||||
var document = this.element.ownerDocument;
|
var document = this.element.ownerDocument;
|
||||||
var prompt = dom.createElement(document, 'span');
|
var prompt = dom.createElement(document, 'span');
|
||||||
|
@ -6166,14 +6190,24 @@ Completer.prototype.update = function(input) {
|
||||||
// Add a grey '}' to the end of the command line when we've opened
|
// Add a grey '}' to the end of the command line when we've opened
|
||||||
// with a { but haven't closed it
|
// with a { but haven't closed it
|
||||||
var command = this.requisition.commandAssignment.getValue();
|
var command = this.requisition.commandAssignment.getValue();
|
||||||
var unclosedJs = command && command.name === '{' &&
|
var isJsCommand = (command && command.name === '{');
|
||||||
|
var isUnclosedJs = isJsCommand &&
|
||||||
this.requisition.getAssignment(0).getArg().suffix.indexOf('}') === -1;
|
this.requisition.getAssignment(0).getArg().suffix.indexOf('}') === -1;
|
||||||
if (unclosedJs) {
|
if (isUnclosedJs) {
|
||||||
var close = dom.createElement(document, 'span');
|
var close = dom.createElement(document, 'span');
|
||||||
close.classList.add('gcli-in-closebrace');
|
close.classList.add('gcli-in-closebrace');
|
||||||
close.appendChild(document.createTextNode(' }'));
|
close.appendChild(document.createTextNode(' }'));
|
||||||
this.element.appendChild(close);
|
this.element.appendChild(close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a scratchpad link if it's a JS command and we have a function to
|
||||||
|
// actually perform the request
|
||||||
|
if (isJsCommand && this.scratchpad) {
|
||||||
|
var hint = dom.createElement(document, 'div');
|
||||||
|
hint.classList.add('gcli-in-scratchlink');
|
||||||
|
hint.appendChild(document.createTextNode(this.scratchpad.linkText));
|
||||||
|
this.element.appendChild(hint);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6286,7 +6320,8 @@ History.prototype.backward = function() {
|
||||||
|
|
||||||
exports.History = History;
|
exports.History = History;
|
||||||
|
|
||||||
});define("text!gcli/ui/inputter.css", [], void 0);
|
});define("text!gcli/ui/inputter.css", [], "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||||
* Licensed under the New BSD license. See LICENSE.txt or:
|
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||||
|
@ -7419,7 +7454,8 @@ exports.CommandMenu = CommandMenu;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
define("text!gcli/ui/menu.css", [], void 0);
|
define("text!gcli/ui/menu.css", [], "");
|
||||||
|
|
||||||
define("text!gcli/ui/menu.html", [], "\n" +
|
define("text!gcli/ui/menu.html", [], "\n" +
|
||||||
"<table class=\"gcli-menu-template\" aria-live=\"polite\">\n" +
|
"<table class=\"gcli-menu-template\" aria-live=\"polite\">\n" +
|
||||||
" <tr class=\"gcli-menu-option\" foreach=\"item in ${items}\"\n" +
|
" <tr class=\"gcli-menu-option\" foreach=\"item in ${items}\"\n" +
|
||||||
|
@ -7433,7 +7469,8 @@ define("text!gcli/ui/menu.html", [], "\n" +
|
||||||
"</table>\n" +
|
"</table>\n" +
|
||||||
"");
|
"");
|
||||||
|
|
||||||
define("text!gcli/ui/arg_fetch.css", [], void 0);
|
define("text!gcli/ui/arg_fetch.css", [], "");
|
||||||
|
|
||||||
define("text!gcli/ui/arg_fetch.html", [], "\n" +
|
define("text!gcli/ui/arg_fetch.html", [], "\n" +
|
||||||
"<!--\n" +
|
"<!--\n" +
|
||||||
"Template for an Assignment.\n" +
|
"Template for an Assignment.\n" +
|
||||||
|
|
|
@ -150,6 +150,7 @@ _BROWSER_TEST_FILES = \
|
||||||
browser_webconsole_bug_658368_time_methods.js \
|
browser_webconsole_bug_658368_time_methods.js \
|
||||||
browser_webconsole_bug_622303_persistent_filters.js \
|
browser_webconsole_bug_622303_persistent_filters.js \
|
||||||
browser_webconsole_window_zombie.js \
|
browser_webconsole_window_zombie.js \
|
||||||
|
browser_cached_messages.js \
|
||||||
head.js \
|
head.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
@ -222,6 +223,7 @@ _BROWSER_TEST_PAGES = \
|
||||||
test-file-location.js \
|
test-file-location.js \
|
||||||
browser_gcli_inspect.html \
|
browser_gcli_inspect.html \
|
||||||
test-bug-658368-time-methods.html \
|
test-bug-658368-time-methods.html \
|
||||||
|
test-webconsole-error-observer.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_BROWSER_TEST_FILES)
|
libs:: $(_BROWSER_TEST_FILES)
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is DevTools test code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* David Dahl <ddahl@mozilla.com>
|
||||||
|
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-webconsole-error-observer.html";
|
||||||
|
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
waitForExplicitFinish();
|
||||||
|
|
||||||
|
expectUncaughtException();
|
||||||
|
|
||||||
|
gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
|
||||||
|
|
||||||
|
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
||||||
|
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
||||||
|
testOpenUI(true);
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testOpenUI(aTestReopen)
|
||||||
|
{
|
||||||
|
// test to see if the messages are
|
||||||
|
// displayed when the console UI is opened
|
||||||
|
|
||||||
|
HUDService.activateHUDForContext(gBrowser.selectedTab);
|
||||||
|
let hudId = HUDService.getHudIdByWindow(content);
|
||||||
|
let hud = HUDService.getHudReferenceById(hudId);
|
||||||
|
|
||||||
|
testLogEntry(hud.outputNode, "log Bazzle",
|
||||||
|
"Find a console log entry from before console UI is opened",
|
||||||
|
false, null);
|
||||||
|
|
||||||
|
testLogEntry(hud.outputNode, "error Bazzle",
|
||||||
|
"Find a console error entry from before console UI is opened",
|
||||||
|
false, null);
|
||||||
|
|
||||||
|
testLogEntry(hud.outputNode, "bazBug611032", "Found the JavaScript error");
|
||||||
|
testLogEntry(hud.outputNode, "cssColorBug611032", "Found the CSS error");
|
||||||
|
|
||||||
|
HUDService.deactivateHUDForContext(gBrowser.selectedTab);
|
||||||
|
|
||||||
|
if (aTestReopen) {
|
||||||
|
HUDService.deactivateHUDForContext(gBrowser.selectedTab);
|
||||||
|
executeSoon(testOpenUI);
|
||||||
|
} else {
|
||||||
|
executeSoon(finish);
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,7 +54,53 @@ var Node = Components.interfaces.nsIDOMNode;
|
||||||
* http://opensource.org/licenses/BSD-3-Clause
|
* http://opensource.org/licenses/BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
|
define('gclitest/index', ['require', 'exports', 'module' , 'gclitest/suite', 'gcli/types/javascript'], function(require, exports, module) {
|
||||||
|
|
||||||
|
var examiner = require('gclitest/suite').examiner;
|
||||||
|
var javascript = require('gcli/types/javascript');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the tests defined in the test suite
|
||||||
|
* @param options How the tests are run. Properties include:
|
||||||
|
* - window: The browser window object to run the tests against
|
||||||
|
* - useFakeWindow: Use a test subset and a fake DOM to avoid a real document
|
||||||
|
* - detailedResultLog: console.log test passes and failures in more detail
|
||||||
|
*/
|
||||||
|
exports.run = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (options.useFakeWindow) {
|
||||||
|
// A minimum fake dom to get us through the JS tests
|
||||||
|
var doc = { title: 'Fake DOM' };
|
||||||
|
var fakeWindow = {
|
||||||
|
window: { document: doc },
|
||||||
|
document: doc
|
||||||
|
};
|
||||||
|
|
||||||
|
options.window = fakeWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.window) {
|
||||||
|
javascript.setGlobalObject(options.window);
|
||||||
|
}
|
||||||
|
|
||||||
|
examiner.run(options);
|
||||||
|
|
||||||
|
if (options.detailedResultLog) {
|
||||||
|
examiner.log();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('Completed test suite');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||||
|
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||||
|
* http://opensource.org/licenses/BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testScratchpad', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
|
||||||
|
|
||||||
// We need to make sure GCLI is initialized before we begin testing it
|
// We need to make sure GCLI is initialized before we begin testing it
|
||||||
require('gcli/index');
|
require('gcli/index');
|
||||||
|
@ -69,14 +115,12 @@ define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/e
|
||||||
examiner.addSuite('gclitest/testCli', require('gclitest/testCli'));
|
examiner.addSuite('gclitest/testCli', require('gclitest/testCli'));
|
||||||
examiner.addSuite('gclitest/testExec', require('gclitest/testExec'));
|
examiner.addSuite('gclitest/testExec', require('gclitest/testExec'));
|
||||||
examiner.addSuite('gclitest/testKeyboard', require('gclitest/testKeyboard'));
|
examiner.addSuite('gclitest/testKeyboard', require('gclitest/testKeyboard'));
|
||||||
|
examiner.addSuite('gclitest/testScratchpad', require('gclitest/testScratchpad'));
|
||||||
examiner.addSuite('gclitest/testHistory', require('gclitest/testHistory'));
|
examiner.addSuite('gclitest/testHistory', require('gclitest/testHistory'));
|
||||||
examiner.addSuite('gclitest/testRequire', require('gclitest/testRequire'));
|
examiner.addSuite('gclitest/testRequire', require('gclitest/testRequire'));
|
||||||
examiner.addSuite('gclitest/testJs', require('gclitest/testJs'));
|
examiner.addSuite('gclitest/testJs', require('gclitest/testJs'));
|
||||||
|
|
||||||
examiner.run();
|
exports.examiner = examiner;
|
||||||
console.log('Completed test suite');
|
|
||||||
// examiner.log();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||||
|
@ -119,10 +163,10 @@ examiner.addSuite = function(name, suite) {
|
||||||
/**
|
/**
|
||||||
* Run all the tests synchronously
|
* Run all the tests synchronously
|
||||||
*/
|
*/
|
||||||
examiner.run = function() {
|
examiner.run = function(options) {
|
||||||
Object.keys(examiner.suites).forEach(function(suiteName) {
|
Object.keys(examiner.suites).forEach(function(suiteName) {
|
||||||
var suite = examiner.suites[suiteName];
|
var suite = examiner.suites[suiteName];
|
||||||
suite.run();
|
suite.run(options);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
return examiner.suites;
|
return examiner.suites;
|
||||||
};
|
};
|
||||||
|
@ -130,14 +174,14 @@ examiner.run = function() {
|
||||||
/**
|
/**
|
||||||
* Run all the tests asynchronously
|
* Run all the tests asynchronously
|
||||||
*/
|
*/
|
||||||
examiner.runAsync = function(callback) {
|
examiner.runAsync = function(options, callback) {
|
||||||
this.runAsyncInternal(0, callback);
|
this.runAsyncInternal(0, options, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run all the test suits asynchronously
|
* Run all the test suits asynchronously
|
||||||
*/
|
*/
|
||||||
examiner.runAsyncInternal = function(i, callback) {
|
examiner.runAsyncInternal = function(i, options, callback) {
|
||||||
if (i >= Object.keys(examiner.suites).length) {
|
if (i >= Object.keys(examiner.suites).length) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback();
|
callback();
|
||||||
|
@ -146,9 +190,9 @@ examiner.runAsyncInternal = function(i, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var suiteName = Object.keys(examiner.suites)[i];
|
var suiteName = Object.keys(examiner.suites)[i];
|
||||||
examiner.suites[suiteName].runAsync(function() {
|
examiner.suites[suiteName].runAsync(options, function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
examiner.runAsyncInternal(i + 1, callback);
|
examiner.runAsyncInternal(i + 1, options, callback);
|
||||||
}.bind(this), delay);
|
}.bind(this), delay);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
@ -222,30 +266,30 @@ function Suite(suiteName, suite) {
|
||||||
/**
|
/**
|
||||||
* Run all the tests in this suite synchronously
|
* Run all the tests in this suite synchronously
|
||||||
*/
|
*/
|
||||||
Suite.prototype.run = function() {
|
Suite.prototype.run = function(options) {
|
||||||
if (typeof this.suite.setup == "function") {
|
if (typeof this.suite.setup == "function") {
|
||||||
this.suite.setup();
|
this.suite.setup(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(this.tests).forEach(function(testName) {
|
Object.keys(this.tests).forEach(function(testName) {
|
||||||
var test = this.tests[testName];
|
var test = this.tests[testName];
|
||||||
test.run();
|
test.run(options);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
if (typeof this.suite.shutdown == "function") {
|
if (typeof this.suite.shutdown == "function") {
|
||||||
this.suite.shutdown();
|
this.suite.shutdown(options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run all the tests in this suite asynchronously
|
* Run all the tests in this suite asynchronously
|
||||||
*/
|
*/
|
||||||
Suite.prototype.runAsync = function(callback) {
|
Suite.prototype.runAsync = function(options, callback) {
|
||||||
if (typeof this.suite.setup == "function") {
|
if (typeof this.suite.setup == "function") {
|
||||||
this.suite.setup();
|
this.suite.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.runAsyncInternal(0, function() {
|
this.runAsyncInternal(0, options, function() {
|
||||||
if (typeof this.suite.shutdown == "function") {
|
if (typeof this.suite.shutdown == "function") {
|
||||||
this.suite.shutdown();
|
this.suite.shutdown();
|
||||||
}
|
}
|
||||||
|
@ -259,7 +303,7 @@ Suite.prototype.runAsync = function(callback) {
|
||||||
/**
|
/**
|
||||||
* Function used by the async runners that can handle async recursion.
|
* Function used by the async runners that can handle async recursion.
|
||||||
*/
|
*/
|
||||||
Suite.prototype.runAsyncInternal = function(i, callback) {
|
Suite.prototype.runAsyncInternal = function(i, options, callback) {
|
||||||
if (i >= Object.keys(this.tests).length) {
|
if (i >= Object.keys(this.tests).length) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback();
|
callback();
|
||||||
|
@ -268,9 +312,9 @@ Suite.prototype.runAsyncInternal = function(i, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var testName = Object.keys(this.tests)[i];
|
var testName = Object.keys(this.tests)[i];
|
||||||
this.tests[testName].runAsync(function() {
|
this.tests[testName].runAsync(options, function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
this.runAsyncInternal(i + 1, callback);
|
this.runAsyncInternal(i + 1, options, callback);
|
||||||
}.bind(this), delay);
|
}.bind(this), delay);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
};
|
};
|
||||||
|
@ -304,13 +348,13 @@ function Test(suite, name, func) {
|
||||||
/**
|
/**
|
||||||
* Run just a single test
|
* Run just a single test
|
||||||
*/
|
*/
|
||||||
Test.prototype.run = function() {
|
Test.prototype.run = function(options) {
|
||||||
currentTest = this;
|
currentTest = this;
|
||||||
this.status = stati.executing;
|
this.status = stati.executing;
|
||||||
this.messages = [];
|
this.messages = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.func.apply(this.suite);
|
this.func.apply(this.suite, [ options ]);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
this.status = stati.fail;
|
this.status = stati.fail;
|
||||||
|
@ -331,7 +375,7 @@ Test.prototype.run = function() {
|
||||||
/**
|
/**
|
||||||
* Run all the tests in this suite asynchronously
|
* Run all the tests in this suite asynchronously
|
||||||
*/
|
*/
|
||||||
Test.prototype.runAsync = function(callback) {
|
Test.prototype.runAsync = function(options, callback) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
this.run();
|
this.run();
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
@ -1510,14 +1554,18 @@ function check(initial, action, after) {
|
||||||
test.is(after, requisition.toString(), initial + ' + ' + action + ' -> ' + after);
|
test.is(after, requisition.toString(), initial + ' + ' + action + ' -> ' + after);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.testComplete = function() {
|
exports.testComplete = function(options) {
|
||||||
check('tsela', COMPLETES_TO, 'tselarr ');
|
check('tsela', COMPLETES_TO, 'tselarr ');
|
||||||
check('tsn di', COMPLETES_TO, 'tsn dif ');
|
check('tsn di', COMPLETES_TO, 'tsn dif ');
|
||||||
check('tsg a', COMPLETES_TO, 'tsg aaa ');
|
check('tsg a', COMPLETES_TO, 'tsg aaa ');
|
||||||
|
|
||||||
check('{ wind', COMPLETES_TO, '{ window');
|
check('{ wind', COMPLETES_TO, '{ window');
|
||||||
check('{ window.docum', COMPLETES_TO, '{ window.document');
|
check('{ window.docum', COMPLETES_TO, '{ window.document');
|
||||||
check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
|
|
||||||
|
// Bug 717228: This fails under node
|
||||||
|
if (!options.isNode) {
|
||||||
|
check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.testIncrDecr = function() {
|
exports.testIncrDecr = function() {
|
||||||
|
@ -1572,6 +1620,59 @@ exports.testIncrDecr = function() {
|
||||||
check('tselarr 3', KEY_UPS_TO, 'tselarr 2');
|
check('tselarr 3', KEY_UPS_TO, 'tselarr 2');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||||
|
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||||
|
* http://opensource.org/licenses/BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
define('gclitest/testScratchpad', ['require', 'exports', 'module' , 'test/assert'], function(require, exports, module) {
|
||||||
|
|
||||||
|
|
||||||
|
var test = require('test/assert');
|
||||||
|
|
||||||
|
var origScratchpad;
|
||||||
|
|
||||||
|
exports.setup = function(options) {
|
||||||
|
if (options.inputter) {
|
||||||
|
origScratchpad = options.inputter.scratchpad;
|
||||||
|
options.inputter.scratchpad = stubScratchpad;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.shutdown = function(options) {
|
||||||
|
if (options.inputter) {
|
||||||
|
options.inputter.scratchpad = origScratchpad;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var stubScratchpad = {
|
||||||
|
shouldActivate: function(ev) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
activatedCount: 0,
|
||||||
|
linkText: 'scratchpad.linkText'
|
||||||
|
};
|
||||||
|
stubScratchpad.activate = function(value) {
|
||||||
|
stubScratchpad.activatedCount++;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.testActivate = function(options) {
|
||||||
|
if (options.inputter) {
|
||||||
|
var ev = {};
|
||||||
|
stubScratchpad.activatedCount = 0;
|
||||||
|
options.inputter.onKeyUp(ev);
|
||||||
|
test.is(1, stubScratchpad.activatedCount, 'scratchpad is activated');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('Skipping scratchpad tests');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||||
|
@ -1828,6 +1929,11 @@ function check(expStatuses, expStatus, expAssign, expPredict) {
|
||||||
else if (typeof expPredict === 'number') {
|
else if (typeof expPredict === 'number') {
|
||||||
contains = true;
|
contains = true;
|
||||||
test.is(assign.getPredictions().length, expPredict, 'prediction count');
|
test.is(assign.getPredictions().length, expPredict, 'prediction count');
|
||||||
|
if (assign.getPredictions().length !== expPredict) {
|
||||||
|
assign.getPredictions().forEach(function(prediction) {
|
||||||
|
console.log('actual prediction: ', prediction);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
contains = predictionsHas(expPredict);
|
contains = predictionsHas(expPredict);
|
||||||
|
@ -1856,7 +1962,7 @@ exports.testBasic = function() {
|
||||||
check('VVIIIII', Status.ERROR, 'windo', 'window');
|
check('VVIIIII', Status.ERROR, 'windo', 'window');
|
||||||
|
|
||||||
input('{ window');
|
input('{ window');
|
||||||
check('VVVVVVVV', Status.VALID, 'window', 0);
|
check('VVVVVVVV', Status.VALID, 'window');
|
||||||
|
|
||||||
input('{ window.d');
|
input('{ window.d');
|
||||||
check('VVIIIIIIII', Status.ERROR, 'window.d', 'window.document');
|
check('VVIIIIIIII', Status.ERROR, 'window.d', 'window.document');
|
||||||
|
@ -1898,6 +2004,7 @@ exports.testBasic = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function undefine() {
|
function undefine() {
|
||||||
|
delete define.modules['gclitest/index'];
|
||||||
delete define.modules['gclitest/suite'];
|
delete define.modules['gclitest/suite'];
|
||||||
delete define.modules['test/examiner'];
|
delete define.modules['test/examiner'];
|
||||||
delete define.modules['gclitest/testTokenize'];
|
delete define.modules['gclitest/testTokenize'];
|
||||||
|
@ -1907,11 +2014,13 @@ function undefine() {
|
||||||
delete define.modules['gclitest/testCli'];
|
delete define.modules['gclitest/testCli'];
|
||||||
delete define.modules['gclitest/testExec'];
|
delete define.modules['gclitest/testExec'];
|
||||||
delete define.modules['gclitest/testKeyboard'];
|
delete define.modules['gclitest/testKeyboard'];
|
||||||
|
delete define.modules['gclitest/testScratchpad'];
|
||||||
delete define.modules['gclitest/testHistory'];
|
delete define.modules['gclitest/testHistory'];
|
||||||
delete define.modules['gclitest/testRequire'];
|
delete define.modules['gclitest/testRequire'];
|
||||||
delete define.modules['gclitest/requirable'];
|
delete define.modules['gclitest/requirable'];
|
||||||
delete define.modules['gclitest/testJs'];
|
delete define.modules['gclitest/testJs'];
|
||||||
|
|
||||||
|
delete define.globalDomain.modules['gclitest/index'];
|
||||||
delete define.globalDomain.modules['gclitest/suite'];
|
delete define.globalDomain.modules['gclitest/suite'];
|
||||||
delete define.globalDomain.modules['test/examiner'];
|
delete define.globalDomain.modules['test/examiner'];
|
||||||
delete define.globalDomain.modules['gclitest/testTokenize'];
|
delete define.globalDomain.modules['gclitest/testTokenize'];
|
||||||
|
@ -1921,6 +2030,7 @@ function undefine() {
|
||||||
delete define.globalDomain.modules['gclitest/testCli'];
|
delete define.globalDomain.modules['gclitest/testCli'];
|
||||||
delete define.globalDomain.modules['gclitest/testExec'];
|
delete define.globalDomain.modules['gclitest/testExec'];
|
||||||
delete define.globalDomain.modules['gclitest/testKeyboard'];
|
delete define.globalDomain.modules['gclitest/testKeyboard'];
|
||||||
|
delete define.globalDomain.modules['gclitest/testScratchpad'];
|
||||||
delete define.globalDomain.modules['gclitest/testHistory'];
|
delete define.globalDomain.modules['gclitest/testHistory'];
|
||||||
delete define.globalDomain.modules['gclitest/testRequire'];
|
delete define.globalDomain.modules['gclitest/testRequire'];
|
||||||
delete define.globalDomain.modules['gclitest/requirable'];
|
delete define.globalDomain.modules['gclitest/requirable'];
|
||||||
|
@ -1948,12 +2058,20 @@ function onLoad() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
openConsole();
|
openConsole();
|
||||||
define.globalDomain.require("gclitest/index");
|
|
||||||
|
var gcliterm = HUDService.getHudByWindow(content).gcliterm;
|
||||||
|
|
||||||
|
var gclitest = define.globalDomain.require("gclitest/index");
|
||||||
|
gclitest.run({
|
||||||
|
window: gcliterm.document.defaultView,
|
||||||
|
inputter: gcliterm.opts.console.inputter,
|
||||||
|
requisition: gcliterm.opts.requistion
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
failed = ex;
|
failed = ex;
|
||||||
console.error('Test Failure', ex);
|
console.error("Test Failure", ex);
|
||||||
ok(false, '' + ex);
|
ok(false, "" + ex);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
closeConsole();
|
closeConsole();
|
||||||
|
|
|
@ -48,6 +48,9 @@ function test()
|
||||||
browser.removeEventListener("load", arguments.callee, true);
|
browser.removeEventListener("load", arguments.callee, true);
|
||||||
|
|
||||||
openConsole();
|
openConsole();
|
||||||
|
// Clear cached messages that are shown once the Web Console opens.
|
||||||
|
HUDService.getHudByWindow(content).jsterm.clearOutput(true);
|
||||||
|
|
||||||
browser.addEventListener("load", onContentLoaded, true);
|
browser.addEventListener("load", onContentLoaded, true);
|
||||||
content.location.reload();
|
content.location.reload();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* David Dahl <ddahl@mozilla.com>
|
* David Dahl <ddahl@mozilla.com>
|
||||||
|
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
@ -35,37 +36,34 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
|
const TEST_URI = "data:text/html,<p>Web Console test for notifications";
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
observer.init();
|
observer.init();
|
||||||
addTab(TEST_URI);
|
addTab(TEST_URI);
|
||||||
browser.addEventListener("DOMContentLoaded", onLoad, false);
|
browser.addEventListener("load", onLoad, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function webConsoleCreated(aID)
|
function webConsoleCreated(aID)
|
||||||
{
|
{
|
||||||
Services.obs.removeObserver(observer, "web-console-created");
|
Services.obs.removeObserver(observer, "web-console-created");
|
||||||
executeSoon(function (){
|
ok(HUDService.hudReferences[aID], "We have a hud reference");
|
||||||
ok(HUDService.hudReferences[aID], "We have a hud reference");
|
content.wrappedJSObject.console.log("adding a log message");
|
||||||
let console = browser.contentWindow.wrappedJSObject.console;
|
|
||||||
console.log("adding a log message");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function webConsoleDestroyed(aID)
|
function webConsoleDestroyed(aID)
|
||||||
{
|
{
|
||||||
Services.obs.removeObserver(observer, "web-console-destroyed");
|
Services.obs.removeObserver(observer, "web-console-destroyed");
|
||||||
ok(!HUDService.hudReferences[aID], "We do not have a hud reference");
|
ok(!HUDService.hudReferences[aID], "We do not have a hud reference");
|
||||||
finishTest();
|
executeSoon(finishTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
function webConsoleMessage(aID, aNodeID)
|
function webConsoleMessage(aID, aNodeID)
|
||||||
{
|
{
|
||||||
Services.obs.removeObserver(observer, "web-console-message-created");
|
Services.obs.removeObserver(observer, "web-console-message-created");
|
||||||
ok(aID, "we have a console ID");
|
ok(aID, "we have a console ID");
|
||||||
ok(typeof aNodeID == 'string', "message node id is not null");
|
is(typeof aNodeID, "string", "message node id is a string");
|
||||||
closeConsole();
|
executeSoon(closeConsole);
|
||||||
}
|
}
|
||||||
|
|
||||||
let observer = {
|
let observer = {
|
||||||
|
@ -100,6 +98,6 @@ let observer = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
browser.removeEventListener("DOMContentLoaded", onLoad, false);
|
browser.removeEventListener("load", onLoad, true);
|
||||||
openConsole();
|
openConsole();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html dir="ltr" xml:lang="en-US" lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title>WebConsoleErrorObserver test - bug 611032</title>
|
||||||
|
<!-- Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
console.log("log Bazzle");
|
||||||
|
console.info("info Bazzle");
|
||||||
|
console.warn("warn Bazzle");
|
||||||
|
console.error("error Bazzle");
|
||||||
|
|
||||||
|
var foo = {};
|
||||||
|
foo.bazBug611032();
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.foo { color: cssColorBug611032; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>WebConsoleErrorObserver test</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -20,7 +20,7 @@ cliEvalJavascript=Enter JavaScript directly
|
||||||
# that has a number of pre-defined options the user interface presents these
|
# that has a number of pre-defined options the user interface presents these
|
||||||
# in a drop-down menu, where the first 'option' is an indicator that a
|
# in a drop-down menu, where the first 'option' is an indicator that a
|
||||||
# selection should be made. This string describes that first option.
|
# selection should be made. This string describes that first option.
|
||||||
fieldSelectionSelect=Select a %S …
|
fieldSelectionSelect=Select a %S…
|
||||||
|
|
||||||
# LOCALIZATION NOTE (fieldArrayAdd): When a command has a parameter that can
|
# LOCALIZATION NOTE (fieldArrayAdd): When a command has a parameter that can
|
||||||
# be repeated a number of times (e.g. like the 'cat a.txt b.txt' command) the
|
# be repeated a number of times (e.g. like the 'cat a.txt b.txt' command) the
|
||||||
|
|
|
@ -146,6 +146,11 @@ webConsolePositionWindow=Window
|
||||||
# the correct direction.
|
# the correct direction.
|
||||||
webConsoleWindowTitleAndURL=Web Console - %S
|
webConsoleWindowTitleAndURL=Web Console - %S
|
||||||
|
|
||||||
|
# LOCALIZATION NOTE (scratchpad.linkText):
|
||||||
|
# The text used in the right hand side of the web console command line when
|
||||||
|
# Javascript is being entered, to indicate how to jump into scratchpad mode
|
||||||
|
scratchpad.linkText=Shift+RETURN - Open in Scratchpad
|
||||||
|
|
||||||
# LOCALIZATION NOTE (Autocomplete.label):
|
# LOCALIZATION NOTE (Autocomplete.label):
|
||||||
# The autocomplete popup panel label/title.
|
# The autocomplete popup panel label/title.
|
||||||
Autocomplete.label=Autocomplete popup
|
Autocomplete.label=Autocomplete popup
|
||||||
|
|
|
@ -173,7 +173,6 @@
|
||||||
|
|
||||||
.gcli-argfetch {
|
.gcli-argfetch {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +186,6 @@
|
||||||
.gcli-af-params {
|
.gcli-af-params {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +305,13 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gcli-in-scratchlink {
|
||||||
|
float: right;
|
||||||
|
font-size: 85%;
|
||||||
|
color: #888;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* From: $GCLI/lib/gcli/commands/help.css */
|
/* From: $GCLI/lib/gcli/commands/help.css */
|
||||||
|
|
||||||
.gcli-help-name {
|
.gcli-help-name {
|
||||||
|
|
|
@ -177,7 +177,6 @@
|
||||||
|
|
||||||
.gcli-argfetch {
|
.gcli-argfetch {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +190,6 @@
|
||||||
.gcli-af-params {
|
.gcli-af-params {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,6 +309,13 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gcli-in-scratchlink {
|
||||||
|
float: right;
|
||||||
|
font-size: 85%;
|
||||||
|
color: #888;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* From: $GCLI/lib/gcli/commands/help.css */
|
/* From: $GCLI/lib/gcli/commands/help.css */
|
||||||
|
|
||||||
.gcli-help-name {
|
.gcli-help-name {
|
||||||
|
|
|
@ -173,7 +173,6 @@
|
||||||
|
|
||||||
.gcli-argfetch {
|
.gcli-argfetch {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +186,6 @@
|
||||||
.gcli-af-params {
|
.gcli-af-params {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +305,13 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gcli-in-scratchlink {
|
||||||
|
float: right;
|
||||||
|
font-size: 85%;
|
||||||
|
color: #888;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* From: $GCLI/lib/gcli/commands/help.css */
|
/* From: $GCLI/lib/gcli/commands/help.css */
|
||||||
|
|
||||||
.gcli-help-name {
|
.gcli-help-name {
|
||||||
|
|
|
@ -202,7 +202,8 @@ ConsoleAPI.prototype = {
|
||||||
filename: frame.filename,
|
filename: frame.filename,
|
||||||
lineNumber: frame.lineNumber,
|
lineNumber: frame.lineNumber,
|
||||||
functionName: frame.functionName,
|
functionName: frame.functionName,
|
||||||
arguments: aArguments
|
arguments: aArguments,
|
||||||
|
timeStamp: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
consoleEvent.wrappedJSObject = consoleEvent;
|
consoleEvent.wrappedJSObject = consoleEvent;
|
||||||
|
|
|
@ -121,7 +121,7 @@ var ConsoleAPIStorage = {
|
||||||
*/
|
*/
|
||||||
getEvents: function CS_getEvents(aId)
|
getEvents: function CS_getEvents(aId)
|
||||||
{
|
{
|
||||||
return _consoleStorage[aId] || [];
|
return (_consoleStorage[aId] || []).slice(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,18 +103,15 @@ MBS_ApplyPatch(const MBSPatchHeader *header, FILE* patchFile,
|
||||||
size_t r = header->cblen + header->difflen + header->extralen;
|
size_t r = header->cblen + header->difflen + header->extralen;
|
||||||
unsigned char *wb = buf;
|
unsigned char *wb = buf;
|
||||||
while (r) {
|
while (r) {
|
||||||
size_t c = fread(wb, 1, (r > SSIZE_MAX) ? SSIZE_MAX : r, patchFile);
|
const size_t count = (r > SSIZE_MAX) ? SSIZE_MAX : r;
|
||||||
if (c < 0) {
|
size_t c = fread(wb, 1, count, patchFile);
|
||||||
|
if (c != count) {
|
||||||
rv = READ_ERROR;
|
rv = READ_ERROR;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
r -= c;
|
r -= c;
|
||||||
|
wb += c;
|
||||||
if (c == 0 && r) {
|
|
||||||
rv = UNEXPECTED_ERROR;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -1038,8 +1038,9 @@ PatchFile::LoadSourceFile(FILE* ofile)
|
||||||
size_t r = header.slen;
|
size_t r = header.slen;
|
||||||
unsigned char *rb = buf;
|
unsigned char *rb = buf;
|
||||||
while (r) {
|
while (r) {
|
||||||
size_t c = fread(rb, 1, r, ofile);
|
const size_t count = mmin(SSIZE_MAX, r);
|
||||||
if (c < 0) {
|
size_t c = fread(rb, 1, count, ofile);
|
||||||
|
if (c != count) {
|
||||||
LOG(("LoadSourceFile: error reading destination file: " LOG_S "\n",
|
LOG(("LoadSourceFile: error reading destination file: " LOG_S "\n",
|
||||||
mFile));
|
mFile));
|
||||||
return READ_ERROR;
|
return READ_ERROR;
|
||||||
|
@ -1047,11 +1048,6 @@ PatchFile::LoadSourceFile(FILE* ofile)
|
||||||
|
|
||||||
r -= c;
|
r -= c;
|
||||||
rb += c;
|
rb += c;
|
||||||
|
|
||||||
if (c == 0 && r) {
|
|
||||||
LOG(("LoadSourceFile: expected %d more bytes in destination file\n", r));
|
|
||||||
return UNEXPECTED_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that the contents of the source file correspond to what we expect.
|
// Verify that the contents of the source file correspond to what we expect.
|
||||||
|
@ -2411,17 +2407,15 @@ GetManifestContents(const NS_tchar *manifest)
|
||||||
size_t r = ms.st_size;
|
size_t r = ms.st_size;
|
||||||
char *rb = mbuf;
|
char *rb = mbuf;
|
||||||
while (r) {
|
while (r) {
|
||||||
size_t c = fread(rb, 1, mmin(SSIZE_MAX, r), mfile);
|
const size_t count = mmin(SSIZE_MAX, r);
|
||||||
if (c < 0) {
|
size_t c = fread(rb, 1, count, mfile);
|
||||||
|
if (c != count) {
|
||||||
LOG(("GetManifestContents: error reading manifest file: " LOG_S "\n", manifest));
|
LOG(("GetManifestContents: error reading manifest file: " LOG_S "\n", manifest));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r -= c;
|
r -= c;
|
||||||
rb += c;
|
rb += c;
|
||||||
|
|
||||||
if (c == 0 && r)
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
mbuf[ms.st_size] = '\0';
|
mbuf[ms.st_size] = '\0';
|
||||||
rb = mbuf;
|
rb = mbuf;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче