toolkit/components/console/content/consoleBindings.xml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 5
michael@0 6
michael@0 7 <!DOCTYPE bindings SYSTEM "chrome://global/locale/console.dtd">
michael@0 8
michael@0 9 <bindings id="consoleBindings"
michael@0 10 xmlns="http://www.mozilla.org/xbl"
michael@0 11 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 12 xmlns:xbl="http://www.mozilla.org/xbl">
michael@0 13
michael@0 14 <binding id="console-box" extends="xul:box">
michael@0 15 <content>
michael@0 16 <xul:stringbundle src="chrome://global/locale/console.properties" role="string-bundle"/>
michael@0 17 <xul:vbox class="console-box-internal">
michael@0 18 <xul:vbox class="console-rows" role="console-rows" xbl:inherits="dir=sortOrder"/>
michael@0 19 </xul:vbox>
michael@0 20 </content>
michael@0 21
michael@0 22 <implementation>
michael@0 23 <field name="limit" readonly="true">
michael@0 24 250
michael@0 25 </field>
michael@0 26
michael@0 27 <field name="fieldMaxLength" readonly="true">
michael@0 28 <!-- Limit displayed string lengths to avoid performance issues. (Bug 796179 and 831020) -->
michael@0 29 200
michael@0 30 </field>
michael@0 31
michael@0 32 <field name="showChromeErrors" readonly="true">
michael@0 33 Services.prefs.getBoolPref("javascript.options.showInConsole");
michael@0 34 </field>
michael@0 35
michael@0 36 <property name="count" readonly="true">
michael@0 37 <getter>return this.mCount</getter>
michael@0 38 </property>
michael@0 39
michael@0 40 <property name="mode">
michael@0 41 <getter>return this.mMode;</getter>
michael@0 42 <setter><![CDATA[
michael@0 43 if (this.mode != val) {
michael@0 44 this.mMode = val || "All";
michael@0 45 this.setAttribute("mode", this.mMode);
michael@0 46 this.selectedItem = null;
michael@0 47 }
michael@0 48 return val;
michael@0 49 ]]></setter>
michael@0 50 </property>
michael@0 51
michael@0 52 <property name="filter">
michael@0 53 <getter>return this.mFilter;</getter>
michael@0 54 <setter><![CDATA[
michael@0 55 val = val.toLowerCase();
michael@0 56 if (this.mFilter != val) {
michael@0 57 this.mFilter = val;
michael@0 58 for (let aRow of this.mConsoleRowBox.children) {
michael@0 59 this.filterElement(aRow);
michael@0 60 }
michael@0 61 }
michael@0 62 return val;
michael@0 63 ]]></setter>
michael@0 64 </property>
michael@0 65
michael@0 66 <property name="sortOrder">
michael@0 67 <getter>return this.getAttribute("sortOrder");</getter>
michael@0 68 <setter>this.setAttribute("sortOrder", val); return val;</setter>
michael@0 69 </property>
michael@0 70 <field name="mSelectedItem">null</field>
michael@0 71 <property name="selectedItem">
michael@0 72 <getter>return this.mSelectedItem</getter>
michael@0 73 <setter><![CDATA[
michael@0 74 if (this.mSelectedItem)
michael@0 75 this.mSelectedItem.removeAttribute("selected");
michael@0 76
michael@0 77 this.mSelectedItem = val;
michael@0 78 if (val)
michael@0 79 val.setAttribute("selected", "true");
michael@0 80
michael@0 81 // Update edit commands
michael@0 82 window.updateCommands("focus");
michael@0 83 return val;
michael@0 84 ]]></setter>
michael@0 85 </property>
michael@0 86
michael@0 87 <method name="init">
michael@0 88 <body><![CDATA[
michael@0 89 this.mCount = 0;
michael@0 90
michael@0 91 this.mConsoleListener = {
michael@0 92 console: this,
michael@0 93 observe : function(aObject) {
michael@0 94 // The message can arrive a little bit after the xbl binding has been
michael@0 95 // unbind. So node.appendItem will not be available anymore.
michael@0 96 if ('appendItem' in this.console)
michael@0 97 this.console.appendItem(aObject);
michael@0 98 }
michael@0 99 };
michael@0 100
michael@0 101 this.mConsoleRowBox = document.getAnonymousElementByAttribute(this, "role", "console-rows");
michael@0 102 this.mStrBundle = document.getAnonymousElementByAttribute(this, "role", "string-bundle");
michael@0 103
michael@0 104 try {
michael@0 105 Services.console.registerListener(this.mConsoleListener);
michael@0 106 } catch (ex) {
michael@0 107 appendItem(
michael@0 108 "Unable to display errors - couldn't get Console Service component. " +
michael@0 109 "(Missing @mozilla.org/consoleservice;1)");
michael@0 110 return;
michael@0 111 }
michael@0 112
michael@0 113 this.mMode = this.getAttribute("mode") || "All";
michael@0 114 this.mFilter = "";
michael@0 115
michael@0 116 this.appendInitialItems();
michael@0 117 window.controllers.insertControllerAt(0, this._controller);
michael@0 118 ]]></body>
michael@0 119 </method>
michael@0 120
michael@0 121 <method name="destroy">
michael@0 122 <body><![CDATA[
michael@0 123 Services.console.unregisterListener(this.mConsoleListener);
michael@0 124 window.controllers.removeController(this._controller);
michael@0 125 ]]></body>
michael@0 126 </method>
michael@0 127
michael@0 128 <method name="appendInitialItems">
michael@0 129 <body><![CDATA[
michael@0 130 var messages = Services.console.getMessageArray();
michael@0 131
michael@0 132 // In case getMessageArray returns 0-length array as null
michael@0 133 if (!messages)
michael@0 134 messages = [];
michael@0 135
michael@0 136 var limit = messages.length - this.limit;
michael@0 137 if (limit < 0) limit = 0;
michael@0 138
michael@0 139 // Checks if console ever been cleared
michael@0 140 for (var i = messages.length - 1; i >= limit; --i)
michael@0 141 if (!messages[i].message)
michael@0 142 break;
michael@0 143
michael@0 144 // Populate with messages after latest "clear"
michael@0 145 while (++i < messages.length)
michael@0 146 this.appendItem(messages[i]);
michael@0 147 ]]></body>
michael@0 148 </method>
michael@0 149
michael@0 150 <method name="appendItem">
michael@0 151 <parameter name="aObject"/>
michael@0 152 <body><![CDATA[
michael@0 153 try {
michael@0 154 // Try to QI it to a script error to get more info
michael@0 155 var scriptError = aObject.QueryInterface(Components.interfaces.nsIScriptError);
michael@0 156
michael@0 157 // filter chrome urls
michael@0 158 if (!this.showChromeErrors && scriptError.sourceName.substr(0, 9) == "chrome://")
michael@0 159 return;
michael@0 160
michael@0 161 // filter private windows
michael@0 162 if (scriptError.isFromPrivateWindow)
michael@0 163 return;
michael@0 164
michael@0 165 this.appendError(scriptError);
michael@0 166 } catch (ex) {
michael@0 167 try {
michael@0 168 // Try to QI it to a console message
michael@0 169 var msg = aObject.QueryInterface(Components.interfaces.nsIConsoleMessage);
michael@0 170 if (msg.message)
michael@0 171 this.appendMessage(msg.message);
michael@0 172 else // observed a null/"clear" message
michael@0 173 this.clearConsole();
michael@0 174 } catch (ex2) {
michael@0 175 // Give up and append the object itself as a string
michael@0 176 this.appendMessage(aObject);
michael@0 177 }
michael@0 178 }
michael@0 179 ]]></body>
michael@0 180 </method>
michael@0 181
michael@0 182 <method name="_truncateIfNecessary">
michael@0 183 <parameter name="aString"/>
michael@0 184 <parameter name="aMiddleCharacter"/>
michael@0 185 <body><![CDATA[
michael@0 186 if (!aString || aString.length <= this.fieldMaxLength)
michael@0 187 return {string: aString, column: aMiddleCharacter};
michael@0 188 let halfLimit = this.fieldMaxLength / 2;
michael@0 189 if (!aMiddleCharacter || aMiddleCharacter < 0 || aMiddleCharacter > aString.length)
michael@0 190 aMiddleCharacter = halfLimit;
michael@0 191
michael@0 192 let startPosition = 0;
michael@0 193 let endPosition = aString.length;
michael@0 194 if (aMiddleCharacter - halfLimit >= 0)
michael@0 195 startPosition = aMiddleCharacter - halfLimit;
michael@0 196 if (aMiddleCharacter + halfLimit <= aString.length)
michael@0 197 endPosition = aMiddleCharacter + halfLimit;
michael@0 198 if (endPosition - startPosition < this.fieldMaxLength)
michael@0 199 endPosition += this.fieldMaxLength - (endPosition - startPosition);
michael@0 200 let truncatedString = aString.substring(startPosition, endPosition);
michael@0 201 let Ci = Components.interfaces;
michael@0 202 let ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
michael@0 203 Ci.nsIPrefLocalizedString).data;
michael@0 204 if (startPosition > 0) {
michael@0 205 truncatedString = ellipsis + truncatedString;
michael@0 206 aMiddleCharacter += ellipsis.length;
michael@0 207 }
michael@0 208 if (endPosition < aString.length)
michael@0 209 truncatedString = truncatedString + ellipsis;
michael@0 210
michael@0 211 return {
michael@0 212 string: truncatedString,
michael@0 213 column: aMiddleCharacter - startPosition
michael@0 214 };
michael@0 215 ]]></body>
michael@0 216 </method>
michael@0 217
michael@0 218 <method name="appendError">
michael@0 219 <parameter name="aObject"/>
michael@0 220 <body><![CDATA[
michael@0 221 var row = this.createConsoleRow();
michael@0 222 var nsIScriptError = Components.interfaces.nsIScriptError;
michael@0 223
michael@0 224 // Is this error actually just a non-fatal warning?
michael@0 225 var warning = aObject.flags & nsIScriptError.warningFlag != 0;
michael@0 226
michael@0 227 var typetext = warning ? "typeWarning" : "typeError";
michael@0 228 row.setAttribute("typetext", this.mStrBundle.getString(typetext));
michael@0 229 row.setAttribute("type", warning ? "warning" : "error");
michael@0 230 row.setAttribute("msg", aObject.errorMessage);
michael@0 231 row.setAttribute("category", aObject.category);
michael@0 232 row.setAttribute("time", this.properFormatTime(aObject.timeStamp));
michael@0 233 if (aObject.lineNumber || aObject.sourceName) {
michael@0 234 row.setAttribute("href", this._truncateIfNecessary(aObject.sourceName).string);
michael@0 235 row.mSourceName = aObject.sourceName;
michael@0 236 row.setAttribute("line", aObject.lineNumber);
michael@0 237 } else {
michael@0 238 row.setAttribute("hideSource", "true");
michael@0 239 }
michael@0 240 if (aObject.sourceLine) {
michael@0 241 let sourceLine = aObject.sourceLine.replace(/\s/g, " ");
michael@0 242 let truncatedLineObj = this._truncateIfNecessary(sourceLine, aObject.columnNumber);
michael@0 243 row.setAttribute("code", truncatedLineObj.string);
michael@0 244 row.mSourceLine = sourceLine;
michael@0 245 if (aObject.columnNumber) {
michael@0 246 row.setAttribute("col", aObject.columnNumber);
michael@0 247 row.setAttribute("errorDots", this.repeatChar(" ", truncatedLineObj.column));
michael@0 248 row.setAttribute("errorCaret", " ");
michael@0 249 } else {
michael@0 250 row.setAttribute("hideCaret", "true");
michael@0 251 }
michael@0 252 } else {
michael@0 253 row.setAttribute("hideCode", "true");
michael@0 254 }
michael@0 255
michael@0 256 this.appendConsoleRow(row);
michael@0 257 ]]></body>
michael@0 258 </method>
michael@0 259
michael@0 260 <method name="appendMessage">
michael@0 261 <parameter name="aMessage"/>
michael@0 262 <parameter name="aType"/>
michael@0 263 <body><![CDATA[
michael@0 264 var row = this.createConsoleRow();
michael@0 265 row.setAttribute("type", aType || "message");
michael@0 266 row.setAttribute("msg", aMessage);
michael@0 267 this.appendConsoleRow(row);
michael@0 268 ]]></body>
michael@0 269 </method>
michael@0 270
michael@0 271 <method name="clear">
michael@0 272 <body><![CDATA[
michael@0 273 // add a "clear" message (mainly for other listeners)
michael@0 274 Services.console.logStringMessage(null);
michael@0 275 Services.console.reset();
michael@0 276 ]]></body>
michael@0 277 </method>
michael@0 278
michael@0 279 <method name="properFormatTime">
michael@0 280 <parameter name="aTime"/>
michael@0 281 <body><![CDATA[
michael@0 282 const dateServ = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
michael@0 283 .getService(Components.interfaces.nsIScriptableDateFormat);
michael@0 284 let errorTime = new Date(aTime);
michael@0 285 return dateServ.FormatDateTime("", dateServ.dateFormatShort, dateServ.timeFormatSeconds,
michael@0 286 errorTime.getFullYear(), errorTime.getMonth() + 1, errorTime.getDate(),
michael@0 287 errorTime.getHours(), errorTime.getMinutes(), errorTime.getSeconds());
michael@0 288 ]]></body>
michael@0 289 </method>
michael@0 290
michael@0 291 <method name="copySelectedItem">
michael@0 292 <body><![CDATA[
michael@0 293 if (this.mSelectedItem) try {
michael@0 294 const clipURI = "@mozilla.org/widget/clipboardhelper;1";
michael@0 295 const clipI = Components.interfaces.nsIClipboardHelper;
michael@0 296 var clipboard = Components.classes[clipURI].getService(clipI);
michael@0 297
michael@0 298 clipboard.copyString(this.mSelectedItem.toString(), document);
michael@0 299 } catch (ex) {
michael@0 300 // Unable to copy anything, die quietly
michael@0 301 }
michael@0 302 ]]></body>
michael@0 303 </method>
michael@0 304
michael@0 305 <method name="createConsoleRow">
michael@0 306 <body><![CDATA[
michael@0 307 var row = document.createElement("box");
michael@0 308 row.setAttribute("class", "console-row");
michael@0 309 row._IsConsoleRow = true;
michael@0 310 row._ConsoleBox = this;
michael@0 311 return row;
michael@0 312 ]]></body>
michael@0 313 </method>
michael@0 314
michael@0 315 <method name="appendConsoleRow">
michael@0 316 <parameter name="aRow"/>
michael@0 317 <body><![CDATA[
michael@0 318 this.filterElement(aRow);
michael@0 319 this.mConsoleRowBox.appendChild(aRow);
michael@0 320 if (++this.mCount > this.limit) this.deleteFirst();
michael@0 321 ]]></body>
michael@0 322 </method>
michael@0 323
michael@0 324 <method name="deleteFirst">
michael@0 325 <body><![CDATA[
michael@0 326 var node = this.mConsoleRowBox.firstChild;
michael@0 327 this.mConsoleRowBox.removeChild(node);
michael@0 328 --this.mCount;
michael@0 329 ]]></body>
michael@0 330 </method>
michael@0 331
michael@0 332 <method name="clearConsole">
michael@0 333 <body><![CDATA[
michael@0 334 if (this.mCount == 0) // already clear
michael@0 335 return;
michael@0 336 this.mCount = 0;
michael@0 337
michael@0 338 var newRows = this.mConsoleRowBox.cloneNode(false);
michael@0 339 this.mConsoleRowBox.parentNode.replaceChild(newRows, this.mConsoleRowBox);
michael@0 340 this.mConsoleRowBox = newRows;
michael@0 341 this.selectedItem = null;
michael@0 342 ]]></body>
michael@0 343 </method>
michael@0 344
michael@0 345 <method name="filterElement">
michael@0 346 <parameter name="aRow" />
michael@0 347 <body><![CDATA[
michael@0 348 let anyMatch = ["msg", "line", "code"].some(function (key) {
michael@0 349 return (aRow.hasAttribute(key) &&
michael@0 350 this.stringMatchesFilters(aRow.getAttribute(key), this.mFilter));
michael@0 351 }, this) || (aRow.mSourceName &&
michael@0 352 this.stringMatchesFilters(aRow.mSourceName, this.mFilter));
michael@0 353
michael@0 354 if (anyMatch) {
michael@0 355 aRow.classList.remove("filtered-by-string")
michael@0 356 } else {
michael@0 357 aRow.classList.add("filtered-by-string")
michael@0 358 }
michael@0 359 ]]></body>
michael@0 360 </method>
michael@0 361
michael@0 362 <!-- UTILITY FUNCTIONS -->
michael@0 363
michael@0 364 <method name="repeatChar">
michael@0 365 <parameter name="aChar"/>
michael@0 366 <parameter name="aCol"/>
michael@0 367 <body><![CDATA[
michael@0 368 if (--aCol <= 0)
michael@0 369 return "";
michael@0 370
michael@0 371 for (var i = 2; i < aCol; i += i)
michael@0 372 aChar += aChar;
michael@0 373
michael@0 374 return aChar + aChar.slice(0, aCol - aChar.length);
michael@0 375 ]]></body>
michael@0 376 </method>
michael@0 377
michael@0 378 <method name="stringMatchesFilters">
michael@0 379 <parameter name="aString"/>
michael@0 380 <parameter name="aFilter"/>
michael@0 381 <body><![CDATA[
michael@0 382 if (!aString || !aFilter) {
michael@0 383 return true;
michael@0 384 }
michael@0 385
michael@0 386 let searchStr = aString.toLowerCase();
michael@0 387 let filterStrings = aFilter.split(/\s+/);
michael@0 388 return !filterStrings.some(function (f) {
michael@0 389 return searchStr.indexOf(f) == -1;
michael@0 390 });
michael@0 391 ]]></body>
michael@0 392 </method>
michael@0 393
michael@0 394 <constructor> this.init(); </constructor>
michael@0 395 <destructor> this.destroy(); </destructor>
michael@0 396
michael@0 397 <!-- Command controller for the copy command -->
michael@0 398 <field name="_controller"><![CDATA[({
michael@0 399 _outer: this,
michael@0 400
michael@0 401 QueryInterface: function(aIID) {
michael@0 402 if (aIID.equals(Components.interfaces.nsIController) ||
michael@0 403 aIID.equals(Components.interfaces.nsISupports))
michael@0 404 return this;
michael@0 405 throw Components.results.NS_NOINTERFACE;
michael@0 406 },
michael@0 407
michael@0 408 supportsCommand: function(aCommand) {
michael@0 409 return aCommand == "cmd_copy";
michael@0 410 },
michael@0 411
michael@0 412 isCommandEnabled: function(aCommand) {
michael@0 413 return aCommand == "cmd_copy" && this._outer.selectedItem;
michael@0 414 },
michael@0 415
michael@0 416 doCommand: function(aCommand) {
michael@0 417 if (aCommand == "cmd_copy")
michael@0 418 this._outer.copySelectedItem();
michael@0 419 },
michael@0 420
michael@0 421 onEvent: function() { }
michael@0 422 });]]></field>
michael@0 423 </implementation>
michael@0 424
michael@0 425 <handlers>
michael@0 426 <handler event="mousedown"><![CDATA[
michael@0 427 if (event.button == 0 || event.button == 2) {
michael@0 428 var target = event.originalTarget;
michael@0 429
michael@0 430 while (target && !("_IsConsoleRow" in target))
michael@0 431 target = target.parentNode;
michael@0 432
michael@0 433 if (target)
michael@0 434 this.selectedItem = target;
michael@0 435 }
michael@0 436 ]]></handler>
michael@0 437 </handlers>
michael@0 438 </binding>
michael@0 439
michael@0 440 <binding id="error" extends="xul:box">
michael@0 441 <content>
michael@0 442 <xul:box class="console-row-internal-box" flex="1">
michael@0 443 <xul:box class="console-row-icon" align="center" xbl:inherits="selected">
michael@0 444 <xul:image class="console-icon" xbl:inherits="src,type"/>
michael@0 445 </xul:box>
michael@0 446 <xul:vbox class="console-row-content" xbl:inherits="selected" flex="1">
michael@0 447 <xul:box class="console-row-msg" align="start">
michael@0 448 <xul:label class="label" xbl:inherits="value=typetext"/>
michael@0 449 <xul:description class="console-error-msg" xbl:inherits="xbl:text=msg" flex="1"/>
michael@0 450 <xul:label class="label console-time" xbl:inherits="value=time"/>
michael@0 451 </xul:box>
michael@0 452 <xul:box class="console-row-file" xbl:inherits="hidden=hideSource">
michael@0 453 <xul:label class="label" value="&errFile.label;"/>
michael@0 454 <xul:box class="console-error-source" xbl:inherits="href,line"/>
michael@0 455 <xul:spacer flex="1"/>
michael@0 456 <xul:hbox class="lineNumberRow" xbl:inherits="line">
michael@0 457 <xul:label class="label" value="&errLine.label;"/>
michael@0 458 <xul:label class="label" xbl:inherits="value=line"/>
michael@0 459 </xul:hbox>
michael@0 460 </xul:box>
michael@0 461 <xul:vbox class="console-row-code" xbl:inherits="selected,hidden=hideCode">
michael@0 462 <xul:label class="monospace console-code" xbl:inherits="value=code" crop="end"/>
michael@0 463 <xul:box xbl:inherits="hidden=hideCaret">
michael@0 464 <xul:label class="monospace console-dots" xbl:inherits="value=errorDots"/>
michael@0 465 <xul:label class="monospace console-caret" xbl:inherits="value=errorCaret"/>
michael@0 466 <xul:spacer flex="1"/>
michael@0 467 </xul:box>
michael@0 468 </xul:vbox>
michael@0 469 </xul:vbox>
michael@0 470 </xul:box>
michael@0 471 </content>
michael@0 472
michael@0 473 <implementation>
michael@0 474 <field name="mSourceName">null</field>
michael@0 475 <field name="mSourceLine">null</field>
michael@0 476
michael@0 477 <method name="toString">
michael@0 478 <body><![CDATA[
michael@0 479 let msg = "";
michael@0 480 let strBundle = this._ConsoleBox.mStrBundle;
michael@0 481
michael@0 482 if (this.hasAttribute("time"))
michael@0 483 msg += strBundle.getFormattedString("errTime", [this.getAttribute("time")]) + "\n";
michael@0 484
michael@0 485 msg += this.getAttribute("typetext") + " " + this.getAttribute("msg");
michael@0 486
michael@0 487 if (this.hasAttribute("line") && this.mSourceName) {
michael@0 488 msg += "\n" + strBundle.getFormattedString("errFile",
michael@0 489 [this.mSourceName]) + "\n";
michael@0 490 if (this.hasAttribute("col")) {
michael@0 491 msg += strBundle.getFormattedString("errLineCol",
michael@0 492 [this.getAttribute("line"), this.getAttribute("col")]);
michael@0 493 } else
michael@0 494 msg += strBundle.getFormattedString("errLine", [this.getAttribute("line")]);
michael@0 495 }
michael@0 496
michael@0 497 if (this.hasAttribute("code"))
michael@0 498 msg += "\n" + strBundle.getString("errCode") + "\n" + this.mSourceLine;
michael@0 499
michael@0 500 return msg;
michael@0 501 ]]></body>
michael@0 502 </method>
michael@0 503 </implementation>
michael@0 504
michael@0 505 </binding>
michael@0 506
michael@0 507 <binding id="message" extends="xul:box">
michael@0 508 <content>
michael@0 509 <xul:box class="console-internal-box" flex="1">
michael@0 510 <xul:box class="console-row-icon" align="center">
michael@0 511 <xul:image class="console-icon" xbl:inherits="src,type"/>
michael@0 512 </xul:box>
michael@0 513 <xul:vbox class="console-row-content" xbl:inherits="selected" flex="1">
michael@0 514 <xul:vbox class="console-row-msg" flex="1">
michael@0 515 <xul:description class="console-msg-text" xbl:inherits="xbl:text=msg"/>
michael@0 516 </xul:vbox>
michael@0 517 </xul:vbox>
michael@0 518 </xul:box>
michael@0 519 </content>
michael@0 520
michael@0 521 <implementation>
michael@0 522 <method name="toString">
michael@0 523 <body><![CDATA[
michael@0 524 return this.getAttribute("msg");
michael@0 525 ]]></body>
michael@0 526 </method>
michael@0 527 </implementation>
michael@0 528 </binding>
michael@0 529
michael@0 530 <binding id="console-error-source" extends="xul:box">
michael@0 531 <content>
michael@0 532 <xul:label class="text-link" xbl:inherits="value=href" crop="right"/>
michael@0 533 </content>
michael@0 534
michael@0 535 <handlers>
michael@0 536 <handler event="click" phase="capturing" button="0" preventdefault="true">
michael@0 537 <![CDATA[
michael@0 538 var url = document.getBindingParent(this).mSourceName;
michael@0 539 url = url.substring(url.lastIndexOf(" ") + 1);
michael@0 540 var line = getAttribute("line");
michael@0 541 gViewSourceUtils.viewSource(url, null, null, line);
michael@0 542 ]]>
michael@0 543 </handler>
michael@0 544 </handlers>
michael@0 545 </binding>
michael@0 546
michael@0 547 </bindings>

mercurial