Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Attempts to add support for resource:// URLs.

Fix: "newURI(" throws an error when URLs has three slashes "///" such "resource:///modules/XPIProvider.jsm", and these end 'unblockable'.
  • Loading branch information...
commit 742d0ad38a6550f386564e0e1fc080054f8e2c06 1 parent f015ef1
Tito authored
10 chrome/content/console2/console2.css
@@ -77,17 +77,21 @@ sourcelink > label {
77 77 .console-box:not([modeLang~="CSS"]) > .console-row[category~="CSS"],
78 78 .console-box:not([modeLang~="XML"]) > .console-row[category]:not([category~="javascript"]):not([category~="JavaScript"]):not([category~="CSS"]),
79 79
80   -.console-box:not([modeCtx~="Chrome"]) > .console-row[category~="chrome"],
  80 +.console-box:not([modeCtx~="Chrome"]) > .console-row[category~="chrome"]:not([href^="resource://"]),
81 81 .console-box:not([modeCtx~="Chrome"]) > .console-row[category~="component"],
82 82 .console-box:not([modeCtx~="Chrome"]) > .console-row[category~="XPConnect"],
83 83 .console-box:not([modeCtx~="Chrome"]) > .console-row[href^="chrome://"],
84   -.console-box:not([modeCtx~="Chrome"]) > .console-row[href^="resource://"],
  84 +/*.console-box:not([modeCtx~="Chrome"]) > .console-row[href^="resource://"],*/
85 85 .console-box:not([modeCtx~="Chrome"]) > .console-row[type="error"]:not([category]),
86 86
87 87 .console-box:not([modeCtx~="Content"]) > .console-row:not([category]):not([href^="chrome://"]):not([type="error"]),
88   -.console-box:not([modeCtx~="Content"]) > .console-row[category]:not([category~="chrome"]):not([category~="component"]):not([category~="XPConnect"]):not([href^="chrome://"]):not([href^="resource://"]),
  88 +.console-box:not([modeCtx~="Content"]) > .console-row[category]:not([category~="chrome"]):not([category~="component"]):not([category~="XPConnect"]):not([href^="chrome://"])
  89 +/*:not([href^="resource://"])*/
  90 +,
89 91 .console-box[dupes="false"] > .console-row[dupe="true"],
90 92
  93 +.console-box:not([modeCtx~="Resource"]) > .console-row[href^="resource://"],
  94 +
91 95 .console-row[type="hidden"] {
92 96 display: none;
93 97 }
10 chrome/content/console2/console2.js
@@ -9,7 +9,7 @@ var gCodeToEvaluate = null;
9 9 var gModes = { // set to defaults
10 10 "": { "Errors": true, "Warnings": true, "Messages": true },
11 11 "Lang": { "JS": true, "CSS": false, "XML": false },
12   - "Ctx": { "Chrome": false, "Content": true }
  12 + "Ctx": { "Chrome": false, "Content": true , "Resource": false }
13 13 };
14 14
15 15 var Cc = Components.classes;
@@ -375,13 +375,13 @@ var gBlacklist = ("@mozilla.org/permissionmanager;1" in Cc)?{
375 375 {
376 376 if (this.isSupported(aURL))
377 377 {
378   - this.mPermissionManager.add(this.mIOService.newURI(aURL, null, null), "console2", this.DENY_DOMAIN);
  378 + this.mPermissionManager.add(this.mIOService.newURI(aURL.replace(/\:\/\/+/, '://'), null, null), "console2", this.DENY_DOMAIN);
379 379 }
380 380 },
381 381
382 382 isSupported: function(aURL)
383 383 {
384   - return /^(https?|chrome):\/+./.test(aURL);
  384 + return /^(https?|chrome|resource):\/+./.test(aURL);
385 385 }
386 386 }:{ // non-persisting version for Thunderbird
387 387 mIOService: Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService),
@@ -431,13 +431,13 @@ var gBlacklist = ("@mozilla.org/permissionmanager;1" in Cc)?{
431 431 {
432 432 if (this.isSupported(aURL))
433 433 {
434   - this.mBlocking[this.mIOService.newURI(aURL, null, null).host] = true;
  434 + this.mBlocking[this.mIOService.newURI(aURL.replace(/\:\/\/+/, '://'), null, null).host] = true;
435 435 }
436 436 },
437 437
438 438 isSupported: function(aURL)
439 439 {
440   - return /^(https?|chrome):\/+./.test(aURL);
  440 + return /^(https?|chrome|resource):\/+./.test(aURL);
441 441 }
442 442 };
443 443
2  chrome/content/console2/console2.xml
@@ -184,7 +184,7 @@
184 184
185 185 if (aMessage.sourceName)
186 186 {
187   - row.setAttribute("href", aMessage.sourceName);
  187 + row.setAttribute("href", aMessage.sourceName.replace(/\:\/\/+/, '://'));
188 188 row.setAttribute("line", aMessage.lineNumber || 0);
189 189 }
190 190 else
5 chrome/content/console2/console2.xul
@@ -69,6 +69,7 @@
69 69 <broadcaster id="Console:modeLangXML" label="&lang.xml.label;" oncommand="toggleMode('XML', 'Lang');"/>
70 70 <broadcaster id="Console:modeCtxChrome" label="&ctx.chr.label;" oncommand="toggleMode('Chrome', 'Ctx');"/>
71 71 <broadcaster id="Console:modeCtxContent" label="&ctx.cnt.label;" oncommand="toggleMode('Content', 'Ctx');"/>
  72 + <broadcaster id="Console:modeCtxResource" label="Resource" oncommand="toggleMode('Resource', 'Ctx');"/>
72 73 <broadcaster id="Console:modeDupes" label="&dupes.label;" oncommand="toggleDupes();"/>
73 74 </broadcasterset>
74 75
@@ -97,6 +98,7 @@
97 98 <menuitem type="radio" group="ctx" label="&ctx.all.label;" accesskey="&ctx.all.accesskey;" _mode="All"/>
98 99 <menuitem type="radio" group="ctx" label="&ctx.chr.label;" accesskey="&ctx.chr.accesskey;" _mode="Chrome"/>
99 100 <menuitem type="radio" group="ctx" label="&ctx.cnt.label;" accesskey="&ctx.cnt.accesskey;" _mode="Content"/>
  101 + <menuitem type="radio" group="ctx" label="Resource" accesskey="Z" _mode="Resource"/>
100 102 </menupopup>
101 103 </toolbarbutton>
102 104
@@ -111,6 +113,7 @@
111 113
112 114 <toolbarbutton id="item_modeCtxChrome" type="checkbox" observes="Console:modeCtxChrome" accesskey="&ctx.chr2.accesskey;" tooltiptext="&ctx.chr.tooltip;" class="textonly"/>
113 115 <toolbarbutton id="item_modeCtxContent" type="checkbox" observes="Console:modeCtxContent" accesskey="&ctx.cnt2.accesskey;" tooltiptext="&ctx.cnt.tooltip;" class="textonly"/>
  116 + <toolbarbutton id="item_modeCtxResource" type="checkbox" observes="Console:modeCtxResource" accesskey="Z" tooltiptext="Resource" class="textonly"/>
114 117
115 118 <toolbarbutton id="item_clearConsole" label="&clear.label;" accesskey="&clear.accesskey;" tooltiptext="&clear.tooltip;" oncommand="clearConsole();"/>
116 119 <toolbarbutton id="item_copyItem" observes="cmd_copy" label="&copyCmd.label;" tooltiptext="&copyCmd.tooltip;" class="textonly"/>
@@ -184,7 +187,7 @@
184 187 accesskey="&extBar.accesskey;"
185 188 customizable="true"
186 189 nowindowdrag="true"
187   - defaultset="item_modeLangJS,item_modeLangCSS,item_modeLangXML,separator,item_modeCtxChrome,item_modeCtxContent,spring,menu_consoleTools"
  190 + defaultset="item_modeLangJS,item_modeLangCSS,item_modeLangXML,separator,item_modeCtxChrome,item_modeCtxContent,item_modeCtxResouce,spring,menu_consoleTools"
188 191 context="ToolbarContext"/>
189 192 <toolbar id="ToolbarEval"
190 193 class="chromeclass-toolbar"
1  chrome/content/console2/suite/consoleOverlay.xul
@@ -188,6 +188,7 @@
188 188
189 189 <toolbarbutton id="item_modeCtxChrome" accesskey="&ctx.chr3.accesskey;"/>
190 190 <toolbarbutton id="item_modeCtxContent" accesskey="&ctx.cnt3.accesskey;"/>
  191 + <toolbarbutton id="item_modeCtxResource" accesskey="Z"/>
191 192
192 193 <toolbarbutton id="ButtonEval" accesskey="&evaluate3.accesskey;"/>
193 194 <toolbarbutton id="menu_consoleTools" accesskey="&tools3.accesskey;"/>
BIN  console2-0.8r.xpi
Binary file not shown
2  install.rdf
@@ -5,7 +5,7 @@
5 5 <id>{1280606b-2510-4fe0-97ef-9b5a22eafe80}</id>
6 6
7 7 <name>Console²</name>
8   - <version>0.8</version>
  8 + <version>0.8r</version>
9 9
10 10 <type>2</type><!-- extension -->
11 11 <unpack>false</unpack>

0 comments on commit 742d0ad

Please sign in to comment.
Something went wrong with that request. Please try again.