diff -rNpu6 release/chrome/content/firebug/browserOverlay.xul repository/chrome/content/firebug/browserOverlay.xul --- release/chrome/content/firebug/browserOverlay.xul 2006-05-16 12:52:46.000000000 +0200 +++ repository/chrome/content/firebug/browserOverlay.xul 2006-08-16 19:48:26.000000000 +0200 @@ -51,15 +51,12 @@ - - -1) && !isWarning; + var context = null; + try { + if (!FireBug.showExternalErrors) + { + var win = FireBug.views.js.firebugService.lastErrorWindow; + var context = FireBug.getContextByWindow(win); + } + } + catch (ex) {} + + if (!FireBug.categoryFilter(object.sourceName, object.category, isWarning) || + ((!isJSError || !context) && !FireBug.domainFilter(object.sourceName))) return; if (!isWarning) - FireBug.increaseErrorCount(); + FireBug.increaseErrorCount(context); if (object.flags & Components.interfaces.nsIScriptError.warningFlag) - FireBug.console.log(object, "consoleWarning"); + FireBug.console.log(object, "consoleWarning", null, context); else - FireBug.console.log(object, "consoleError"); + FireBug.console.log(object, "consoleError", null, context); } else if (FireBug.showMessages) FireBug.console.log(object, "object"); } catch (exc) { @@ -1973,25 +1986,25 @@ var FireBugPrefsObserver = FireBug.disableXMLHttpSpy(!FireBug.getBoolPref("showXMLHttpRequests")); } }; /////////////////////////////////////////////////////////////////////////////////////////////////// -var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; +var nsIWebProgressListenerFB = Components.interfaces.nsIWebProgressListener; function FireBugWebProgressListener() { } FireBugWebProgressListener.prototype = { stateIsRequest: false, QueryInterface : function(iid) { - if (iid.equals(Components.interfaces.nsIWebProgressListener) || + if (iid.equals(nsIWebProgressListenerFB) || iid.equals(Components.interfaces.nsISupportsWeakReference) || iid.equals(Components.interfaces.nsISupports)) { return this; } @@ -2015,22 +2028,22 @@ FireBugTabProgressListener.onLocationCha FireBug.attachToWindow(progress.DOMWindow); } FireBugTabProgressListener.onStateChange = function(progress, request, flag, status) { // When the load of the top-level page completes - if (flag & nsIWebProgressListener.STATE_STOP) + if (flag & nsIWebProgressListenerFB.STATE_STOP) FireBug.attachToLoadedWindow(progress.DOMWindow); } var FireBugFrameProgressListener = new FireBugWebProgressListener(); FireBugFrameProgressListener.onStateChange = function(progress, request, flag, status) { // When the load of the top-level page or a frame within begins - if (flag & nsIWebProgressListener.STATE_START) + if (flag & nsIWebProgressListenerFB.STATE_START) FireBug.attachToLoadingWindow(progress.DOMWindow); } /////////////////////////////////////////////////////////////////////////////////////////////////// function XMLHttpRequestSpy(request, context, win) diff -rNpu6 release/chrome/content/firebug/loggers.js repository/chrome/content/firebug/loggers.js --- release/chrome/content/firebug/loggers.js 2006-05-24 03:32:06.000000000 +0200 +++ repository/chrome/content/firebug/loggers.js 2006-08-16 19:45:42.000000000 +0200 @@ -29,15 +29,15 @@ * 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 ***** */ -FireBug_defaultObjectFormat = "object"; +var FireBug_defaultObjectFormat = "object"; -FireBug_objectFormatMap = +var FireBug_objectFormatMap = { "text": FireBug_logText, "undefined": FireBug_logUndefined, "null": FireBug_logNull, "number": FireBug_logPrimitive, "string": FireBug_logString, @@ -57,13 +57,13 @@ FireBug_objectFormatMap = "sourceFile": FireBug_logSourceFile, "stackTrace": FireBug_logStackTrace }; /////////////////////////////////////////////////////////////////////////////////////////////////// -FireBug_appendObject = function(object, logRow, precision, partial) +function FireBug_appendObject(object, logRow, precision, partial) { var format; try { format = FireBug_getFormatForObject(object); } @@ -73,13 +73,13 @@ FireBug_appendObject = function(object, } var formatter = FireBug_objectFormatMap[format]; formatter.apply(this, [object, logRow, precision, partial]); } -FireBug_appendFormatted = function(objects, logRow) +function FireBug_appendFormatted(objects, logRow) { if (!objects || !objects.length) return; var format = objects[0]; var objIndex = 0; @@ -109,13 +109,13 @@ FireBug_appendFormatted = function(objec FireBug_appendObject(objects[i], logRow, 0, false); } } /////////////////////////////////////////////////////////////////////////////////////////////////// -FireBug_getFormatForObject = function(object) +function FireBug_getFormatForObject(object) { var type = typeof(object); if (type == "undefined") return "undefined"; @@ -183,13 +183,13 @@ FireBug_getFormatForObject = function(ob return "string"; else return "object"; } -FireBug_parseFormat = function(format) +function FireBug_parseFormat(format) { var formatParts = []; var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/; var index = 0; @@ -440,24 +440,24 @@ function FireBug_logElement(element, log logRow.appendChild(logLink); } function FireBug_logDocument(doc, logRow, precision, partial) { - var caption = "[Document] " + doc.location; + var caption = FireBugUtils.escapeHTML("[Document] " + doc.location); var logLink = withDocument(logRow.ownerDocument, function() { return FireBugUtils.createObjectLink(doc, caption); }); logRow.appendChild(logLink); } function FireBug_logTextNode(textNode, logRow, precision, partial) { var nodeValue = FireBugUtils.escapeNewLines(textNode.nodeValue); - var caption = "[Text] \"" + nodeValue + "\""; + var caption = FireBugUtils.escapeHTML("[Text] \"" + nodeValue + "\""); var logLink = withDocument(logRow.ownerDocument, function() { return FireBugUtils.createObjectLink(textNode, caption); }); logRow.appendChild(logLink); } @@ -477,13 +477,13 @@ function FireBug_logXMLHttpRequest(spy, (spy.request.channel ? spy.request.channel.name : spy.url); withDocument(logRow.ownerDocument, function() { appendNodes(logRow, [ TWISTY({onclick: onDiscloseXMLHttpRequest}), IMG({"class": "icon XHRSpyIcon"}), - FireBugUtils.createObjectLink(spy, caption, null, onDiscloseXMLHttpRequest), + FireBugUtils.createObjectLink(spy, FireBugUtils.escapeHTML(caption), null, onDiscloseXMLHttpRequest), DIV({"class": "disclosure XHRSpyBody"}) ]); }); logRow.spy = spy; } @@ -736,12 +736,13 @@ function FireBug_createObjectRow(name, v tr.className = "propertyRow" + (isFunction ? " propertyRow-function" : "") + (isConstant ? " propertyRow-constant" : ""); var td = doc.createElement("td"); td.setAttribute("valign", "top"); + td.noWrap = true; td.className = "propertyLabel"; // Create the property name var labelElt = doc.createElement("span"); labelElt.className = "propertyName"; var labelText = doc.createTextNode(name); diff -rNpu6 release/chrome/content/firebug/sourceBox.js repository/chrome/content/firebug/sourceBox.js --- release/chrome/content/firebug/sourceBox.js 2006-05-01 13:10:58.000000000 +0200 +++ repository/chrome/content/firebug/sourceBox.js 2006-08-16 19:45:42.000000000 +0200 @@ -305,14 +305,14 @@ FireBugSourceBox.prototype.getParentObje { var parent = objectBox.parentNode ? objectBox.parentNode.parentNode : null; return parent && parent.targetObject ? parent : null; } FireBugSourceBox.prototype.getChildObjectBox = function(objectBox) -{ - return objectBox.childNodes[1]; +{ + return (objectBox && (objectBox.childNodes.length > 1)) ? objectBox.childNodes[1] : null; } FireBugSourceBox.prototype.getRootNode = function(node) { while (1) { diff -rNpu6 release/chrome/content/firebug/tests/test.html repository/chrome/content/firebug/tests/test.html --- release/chrome/content/firebug/tests/test.html 2006-05-19 02:46:00.000000000 +0200 +++ repository/chrome/content/firebug/tests/test.html 2006-08-16 19:45:42.000000000 +0200 @@ -241,13 +241,13 @@ function onassert(message, source)
- +
diff -rNpu6 release/chrome/content/firebug/utils.js repository/chrome/content/firebug/utils.js --- release/chrome/content/firebug/utils.js 2006-05-16 10:26:14.000000000 +0200 +++ repository/chrome/content/firebug/utils.js 2006-08-16 19:48:26.000000000 +0200 @@ -178,13 +178,13 @@ FireBugUtils.getElementLabel = function( } else { var elementText = this.getElementText(element); if (elementText) { - html += ">" + elementText + ""; + html += ">" + FireBugUtils.escapeHTML(elementText) + ""; html += "</" + tagName + ">"; } else html += "/>"; } @@ -223,27 +223,27 @@ FireBugUtils.getElementFullAttributes = // Hide attributes set by FireBug if (attr.localName.indexOf("firebug-") == 0) continue; html += " " + attr.localName + '="' - + attr.nodeValue + '"'; + + FireBugUtils.escapeHTML(attr.nodeValue) + '"'; } return html; } FireBugUtils.getElementPartialAttributes = function(element) { var html = ""; if (element.id) - html += ' id="' + element.id + '"'; + html += ' id="' + FireBugUtils.escapeHTML(element.id) + '"'; if (element.className) html += ' class="' - + element.className + '"'; + + FireBugUtils.escapeHTML(element.className) + '"'; return html; } FireBugUtils.getElementText = function(element) { @@ -316,13 +316,13 @@ FireBugUtils.getSpecificElementXPath = f * Gets an XPath for an element which describes its hierarchical location. */ FireBugUtils.getElementXPath = function(element) { var paths = []; - for (var element = element; element && element.nodeType == 1; element = element.parentNode) + for (; element && element.nodeType == 1; element = element.parentNode) { var index = 0; for (var sibling = element.previousSibling; sibling; sibling = sibling.previousSibling) { if (sibling.localName == element.localName) ++index; @@ -583,12 +583,13 @@ FireBugUtils.getStackFrameId = function( if (frame.languageName == "JavaScript" && !(frame.filename && frame.filename.indexOf("chrome://firebug/") == 0)) { return frame.filename + "/" + frame.lineNumber; } } + return null; } /////////////////////////////////////////////////////////////////////////////////////////////////// FireBugUtils.createObjectSpan = function(doc, object, title, format) { @@ -720,13 +721,30 @@ FireBugUtils.escapeNewLines = function(v { return value.replace(/\r/g, "\\r").replace(/\n/g, "\\n"); } FireBugUtils.escapeHTML = function(value) { - return value.replace(/&/g, "&").replace(//g, ">"); + function replaceChars(ch) + { + switch (ch) + { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case "'": + return "'"; + case '"': + return """; + } + return "?"; + }; + return String(value).replace(/[<>&"']/g, replaceChars); } /////////////////////////////////////////////////////////////////////////////////////////////////// FireBugUtils.clearNode = function(node) { @@ -823,19 +841,19 @@ var contextDocument = document; FireBugUtils.createElement = function(name, attrs, content) { var node = contextDocument.createElement(name); if (attrs) { - for (var name in attrs) + for (var key in attrs) { - var value = attrs[name]; + var value = attrs[key]; if (typeof(value) == "function") - node[name] = value; + node[key] = value; else - node.setAttribute(name, value); + node.setAttribute(key, value); } } if (content != null && content != undefined) { if (content instanceof Node) diff -rNpu6 release/chrome/content/firebug/views/console.js repository/chrome/content/firebug/views/console.js --- release/chrome/content/firebug/views/console.js 2006-04-28 13:04:30.000000000 +0200 +++ repository/chrome/content/firebug/views/console.js 2006-08-16 19:48:26.000000000 +0200 @@ -114,13 +114,13 @@ FireBugConsoleView.prototype.log = funct // Capture the source link immediately while the source is still on the stack if (sourceLink == true) sourceLink = FireBugUtils.getSourceLinkFromStack(Components.stack); if (!noThrottle && !this.throttleMessage(args, rowClass, rowFunc, context, sourceLink)) - return; + return null; var logRow = this.createLogRow(rowClass); if (!rowFunc) rowFunc = FireBug_logObjectRow; @@ -153,13 +153,13 @@ FireBugConsoleView.prototype.createLogRo } FireBugConsoleView.prototype.appendLogRow = function(logRow, context) { var contextNode = context.contextNodes[this.viewName]; if (!contextNode) - return; + return null; contextNode.appendChild(logRow); logRow.scrollIntoView(); return logRow; diff -rNpu6 release/chrome/content/firebug/views/css.js repository/chrome/content/firebug/views/css.js --- release/chrome/content/firebug/views/css.js 2006-03-23 23:59:32.000000000 +0100 +++ repository/chrome/content/firebug/views/css.js 2006-08-16 19:45:40.000000000 +0200 @@ -104,13 +104,13 @@ FireBugCSSView.prototype.highlightElemen this.highlightedBoxes = []; var box = this.contextNode.firstChild; for (; box; box = treeBox.getNextNodeBox(box, this.contextNode)) { - var object = box.targetObject; + object = box.targetObject; if (object instanceof CSSStyleRule) { FireBugUtils.removeClass(box, "highlight"); for (var i = 0; i < inspectedRules.Count(); ++i) { diff -rNpu6 release/chrome/content/firebug/views/js.js repository/chrome/content/firebug/views/js.js --- release/chrome/content/firebug/views/js.js 2006-05-16 12:15:06.000000000 +0200 +++ repository/chrome/content/firebug/views/js.js 2006-08-16 19:48:26.000000000 +0200 @@ -73,14 +73,14 @@ FireBugJSView.prototype.showContext = fu if (!context.loaded && !this.debugging) return; if (!context.scriptFiles) this.updateScriptFiles(context); - this.populateScriptList(context); - this.populateStackList(context.debugFrame); + this.populateScriptList(context); + this.populateStackList(("debugFrame" in context) ? context.debugFrame : null); if (this.noShowScript) this.noShowScript = false; else if (context.priorState && context.priorState.lastScript) { // If the page was reloaded, re-show the script that was showing on the last page diff -rNpu6 release/chrome/content/firebug/views/source.js repository/chrome/content/firebug/views/source.js --- release/chrome/content/firebug/views/source.js 2006-05-24 03:42:00.000000000 +0200 +++ repository/chrome/content/firebug/views/source.js 2006-08-16 19:45:40.000000000 +0200 @@ -309,15 +309,15 @@ FireBugSourceView.prototype.onEditorKeyP this.applyEditor(null); } } FireBugSourceView.prototype.onEditAttribute = function(targetBox, nodeBox, value) { - targetBox.innerHTML = value; + targetBox.innerHTML = FireBugUtils.escapeHTML(value); - var attrName = targetBox.getAttribute("targetAttr"); + var attrName = targetBox.getAttribute("targetAttr"); nodeBox.targetObject.setAttribute(attrName, value); } /////////////////////////////////////////////////////////////////////////////////////////////////// FireBugSourceView.prototype.onMouseOver = function(event) diff -rNpu6 release/chrome/content/firebug/views/style.js repository/chrome/content/firebug/views/style.js --- release/chrome/content/firebug/views/style.js 2006-05-13 01:01:36.000000000 +0200 +++ repository/chrome/content/firebug/views/style.js 2006-08-16 19:45:40.000000000 +0200 @@ -62,77 +62,77 @@ FireBugStyleView.borderStyles = FireBugStyleView.groups = { margin: { "margin-top": "px", "margin-right": "px", "margin-bottom": "px", - "margin-left": "px", + "margin-left": "px" }, padding: { "padding-top": "px", "padding-right": "px", "padding-bottom": "px", - "padding-left": "px", + "padding-left": "px" }, border: { "border-width": { "border-top-width": "px", "border-right-width": "px", "border-bottom-width": "px", - "border-left-width": "px", + "border-left-width": "px" }, "border-color": { "border-top-color": "rgb", "border-right-color": "rgb", "border-bottom-color": "rgb", - "border-left-color": "rgb", + "border-left-color": "rgb" }, "border-style": { "border-top-style": FireBugStyleView.borderStyles, "border-right-style": FireBugStyleView.borderStyles, "border-bottom-style": FireBugStyleView.borderStyles, - "border-left-style": FireBugStyleView.borderStyles, + "border-left-style": FireBugStyleView.borderStyles }, "-moz-border-radius": { "-moz-border-top-radius": "px", "-moz-border-right-radius": "px", "-moz-border-bottom-radius": "px", - "-moz-border-left-radius": "px", - }, + "-moz-border-left-radius": "px" + } }, outline: { "outline-width": { "outline-top-width": "px", "outline-right-width": "px", "outline-bottom-width": "px", - "outline-left-width": "px", + "outline-left-width": "px" }, "outline-color": { "outline-top-color": "rgb", "outline-right-color": "rgb", "outline-bottom-color": "rgb", - "outline-left-color": "rgb", + "outline-left-color": "rgb" }, "outline-style": { "outline-top-style": FireBugStyleView.borderStyles, "outline-right-style": FireBugStyleView.borderStyles, "outline-bottom-style": FireBugStyleView.borderStyles, - "outline-left-style": FireBugStyleView.borderStyles, - }, + "outline-left-style": FireBugStyleView.borderStyles + } }, box : { "width": "px", "height": "px", "top": "px", "right": "px", "bottom": "px", - "left": "px", + "left": "px" }, background: { "background-color": "rgb", "background-image": "image", "background-repeat": [], @@ -143,13 +143,13 @@ FireBugStyleView.groups = font: { "font-family": "font", "font-size": "px", "font-weight": [], "font-style": [], - "color": "rgb", + "color": "rgb" }, text: { "text-transform": [], "text-decoration": [], "letter-spacing": [], @@ -157,41 +157,41 @@ FireBugStyleView.groups = "line-height": [], "text-align": [], "vertical-align": [], "direction": [], "column-count": [], "column-gap": [], - "column-width": [], + "column-width": [] }, layout: { "position": FireBugStyleView.positions, "display": FireBugStyleView.displays, "visibility": [], "z-index": [], "overflow": [], "white-space": [], "clip": [], "float": [], "clear": [], - "-moz-box-sizing": [], + "-moz-box-sizing": [] }, list: { "list-style-image": "image", "list-style-position": [], "list-style-type": [], - "marker-offset": "px", + "marker-offset": "px" }, user: { "cursor": [], "user-focus": [], "user-select": [], "user-modify": [], - "user-input": [], + "user-input": [] } }; FireBugStyleView.prototype = new FireBugView(); FireBugStyleView.prototype.showContext = function(context) @@ -317,13 +317,13 @@ FireBugStyleView.prototype.validateStyle // Create a link to the selector if (rule) { var selectorText = rule.selectorText.replace("\n", " "); if (selectorText.length > 25) selectorText = selectorText.substr(0, 25) + "..."; - FireBugUtils.makeObjectLink(rule, selectorText, tr.childNodes[2].firstChild); + FireBugUtils.makeObjectLink(rule, FireBugUtils.escapeHTML(selectorText), tr.childNodes[2].firstChild); // Create a link to the file var linkTitle = FireBugUtils.makeURLLinkTitle(href, ruleLine); var source = new SourceLink(href, ruleLine); FireBugUtils.makeObjectLink(source, linkTitle, tr.childNodes[3].firstChild); } @@ -500,22 +500,22 @@ FireBugStyleView.prototype.appendGroups this.appendGroups(group, level+1, tr, table, rows); } } FireBugStyleView.prototype.expandRow = function(tr) { - for (var tr = tr.firstRow; tr; tr = tr.nextRow) + for (tr = tr.firstRow; tr; tr = tr.nextRow) { FireBugUtils.removeClass(tr, "rowCollapsed"); this.expandRow(tr); } } FireBugStyleView.prototype.collapseRow = function(tr) { - for (var tr = tr.firstRow; tr; tr = tr.nextRow) + for (tr = tr.firstRow; tr; tr = tr.nextRow) { FireBugUtils.setClass(tr, "rowCollapsed"); this.collapseRow(tr); } } @@ -578,13 +578,13 @@ FireBugStyleView.prototype.translateStyl "margin-right-value": "margin-right", "margin-bottom-value": "margin-bottom", "margin-left-value": "margin-left", "padding-top-value": "padding-top", "padding-right-value": "padding-right", "padding-bottom-value": "padding-bottom", - "padding-left-value": "padding-left", + "padding-left-value": "padding-left" }; var newName = map[name]; return newName ? newName : name; } /////////////////////////////////////////////////////////////////////////////////////////////////// diff -rNpu6 release/chrome/skin/classic/views/console.css repository/chrome/skin/classic/views/console.css --- release/chrome/skin/classic/views/console.css 2006-05-16 13:07:26.000000000 +0200 +++ repository/chrome/skin/classic/views/console.css 2006-08-16 19:48:26.000000000 +0200 @@ -306,12 +306,13 @@ body { } /*****************************************************************************************/ .propertyLabel { padding-left: 20px; + padding-right: 20px; font-weight: bold; width: 200px; -moz-user-select: none; } .propertyContainerLabel { diff -rNpu6 release/components/firebug-service.js repository/components/firebug-service.js --- release/components/firebug-service.js 2006-05-24 03:42:26.000000000 +0200 +++ repository/components/firebug-service.js 2006-08-16 21:12:54.000000000 +0200 @@ -229,13 +229,28 @@ FireBugService.prototype.enable = functi } catch (exc) { return RETURN_CONTINUE; } } - + + function throwHook(frame, type, rv) + { + service.lastErrorWindow = null; + try + { + var result = {}; + frame.eval("window", "", 0, result) + var win = result.value.getWrappedValue(); + if (win) + service.lastErrorWindow = win; + } + catch (exc) { } + return RETURN_CONTINUE; + } + function errorHook(message, fileName, line, pos, flags, errnum, exc) { try { return service.onError(message, fileName, line, pos, flags, errnum, exc); } @@ -244,13 +259,13 @@ FireBugService.prototype.enable = functi return true; } } this.jsd.debuggerHook = { onExecute: executionHook }; this.jsd.breakpointHook = { onExecute: executionHook }; - //this.jsd.throwHook = { onExecute: executionHook }; + this.jsd.throwHook = { onExecute: throwHook }; this.jsd.debugHook = { onExecute: executionHook }; this.jsd.errorHook = { onError: errorHook }; } FireBugService.prototype.disable = function() { diff -rNpu6 release/components/nsIFireBug.idl repository/components/nsIFireBug.idl --- release/components/nsIFireBug.idl 2006-05-24 03:42:26.000000000 +0200 +++ repository/components/nsIFireBug.idl 2006-08-16 21:12:54.000000000 +0200 @@ -35,8 +35,10 @@ interface nsIFireBug : nsISupports void unregisterDebugger(in nsIFireBugDebugger debugger); void setBreakpoint(in string href, in unsigned long line); void clearBreakpoint(in string href, in unsigned long line); void clearAllBreakpoints(); void enumerateBreakpoints(in string href, in nsIFireBugBreakpointCallback cb); + + readonly attribute nsIDOMWindow lastErrorWindow; }; diff -rNpu6 release/install.rdf repository/install.rdf --- release/install.rdf 2006-05-24 03:42:26.000000000 +0200 +++ repository/install.rdf 2006-08-16 21:12:54.000000000 +0200 @@ -2,13 +2,13 @@ firebug@software.joehewitt.com - 0.4 + 0.4.0.0.1 2 {ec8030f7-c20a-464f-9b0e-13a3a9e97384}