Browse files

cancelEditing func is reverted back to the place

  • Loading branch information...
2 parents 699d672 + 361964a commit 5accb8bc6a320917b56260325b16abcd796f696d @farshidbeheshti farshidbeheshti committed Sep 5, 2012
Showing with 6,506 additions and 5,853 deletions.
  1. +4 −0 extension/bootstrap.js
  2. +1 −1 extension/content/firebug/branch.properties
  3. +11 −3 extension/content/firebug/chrome/activation.js
  4. +6 −4 extension/content/firebug/chrome/chrome.js
  5. +45 −11 extension/content/firebug/chrome/menu.js
  6. +1 −12 extension/content/firebug/chrome/panelActivation.js
  7. +78 −137 extension/content/firebug/chrome/reps.js
  8. +1 −1 extension/content/firebug/chrome/tabContext.js
  9. +25 −22 extension/content/firebug/console/commandHistory.js
  10. +8 −2 extension/content/firebug/console/commandLine.js
  11. +3 −1 extension/content/firebug/console/commandLineExposed.js
  12. +1 −16 extension/content/firebug/console/console.js
  13. +9 −6 extension/content/firebug/console/consolePanel.js
  14. +9 −3 extension/content/firebug/console/errors.js
  15. +33 −6 extension/content/firebug/console/eventMonitor.js
  16. +191 −0 extension/content/firebug/console/functionMonitor.js
  17. +12 −1 extension/content/firebug/cookies/cookie.js
  18. +15 −31 extension/content/firebug/cookies/cookieModule.js
  19. +28 −0 extension/content/firebug/cookies/cookiePanel.js
  20. +45 −13 extension/content/firebug/cookies/cookieReps.js
  21. +9 −1 extension/content/firebug/cookies/cookieUtils.js
  22. +6 −2 extension/content/firebug/cookies/menuUtils.js
  23. +3 −0 extension/content/firebug/css/computedPanel.js
  24. +29 −9 extension/content/firebug/css/cssModule.js
  25. +119 −96 extension/content/firebug/css/cssPanel.js
  26. +44 −16 extension/content/firebug/css/stylePanel.js
  27. +29 −19 extension/content/firebug/dom/domPanel.js
  28. +8 −2 extension/content/firebug/editor/editor.js
  29. +2 −1 extension/content/firebug/firebug.css
  30. +27 −15 extension/content/firebug/firebug.js
  31. +4 −6 extension/content/firebug/firebugOverlay.xul
  32. +1 −1 extension/content/firebug/firefox/bindings.xml
  33. +18 −11 extension/content/firebug/firefox/browserOverlay.js
  34. +55 −45 extension/content/firebug/firefox/external-editors/editors.xul
  35. +26 −4 extension/content/firebug/html/htmlPanel.js
  36. +212 −65 extension/content/firebug/html/layout.js
  37. +0 −10 extension/content/firebug/js/debugger.js
  38. +10 −26 extension/content/firebug/js/scriptPanel.js
  39. +2 −0 extension/content/firebug/js/tabCache.js
  40. +57 −2 extension/content/firebug/js/watchPanel.js
  41. +3 −3 extension/content/firebug/lib/array.js
  42. +0 −35 extension/content/firebug/lib/css.js
  43. +3 −3 extension/content/firebug/lib/deprecated.js
  44. +253 −8 extension/content/firebug/lib/dom.js
  45. +5 −5 extension/content/firebug/lib/fonts.js
  46. +10 −9 extension/content/firebug/lib/object.js
  47. +42 −26 extension/content/firebug/lib/string.js
  48. +25 −0 extension/content/firebug/lib/url.js
  49. +0 −14 extension/content/firebug/lib/wrapper.js
  50. +1 −0 extension/content/firebug/net/fontViewer.js
  51. +1 −1 extension/content/firebug/net/netPanel.js
  52. +7 −19 extension/content/firebug/net/netReps.js
  53. +2 −0 extension/content/firebug/net/netUtils.js
  54. +1 −0 extension/content/firebug/net/xmlViewer.js
  55. +1 −0 extension/defaults/preferences/tracingConsole.js
  56. +3 −3 extension/install.rdf
  57. +2 −2 extension/install.rdf.tpl.xml
  58. +3 −0 extension/locale/en-US/cookies.properties
  59. +7 −7 extension/locale/en-US/firebug-amo.properties
  60. +99 −99 extension/locale/en-US/firebug-tracing.properties
  61. +1,662 −1,664 extension/locale/en-US/firebug.properties
  62. +0 −7 extension/locale/es/firebug-amo.properties
  63. +0 −94 extension/locale/es/firebug-tracing.properties
  64. +0 −1,010 extension/locale/es/firebug.properties
  65. +2 −2 extension/locale/nl/cookies.properties
  66. +47 −7 extension/locale/nl/firebug.properties
  67. +3 −3 extension/locale/zh-CN/cookies.properties
  68. +45 −5 extension/locale/zh-CN/firebug.properties
  69. +2 −55 extension/modules/firebug-service.js
  70. +69 −37 extension/modules/gcli.js
  71. +1 −1 extension/package.json
  72. +8 −0 extension/skin/classic/callstack.css
  73. +2 −3 extension/skin/classic/console.css
  74. +1 −1 extension/skin/classic/css.css
  75. +10 −3 extension/skin/classic/dom.css
  76. +17 −0 extension/skin/classic/firebug.css
  77. +5 −1 extension/skin/classic/html.css
  78. +1 −1 extension/skin/classic/layout.css
  79. +7 −0 extension/skin/classic/mac/firebug.css
  80. +2 −0 extension/skin/classic/mac/panel.css
  81. +13 −13 extension/skin/classic/migrationArrow.svg
  82. +0 −4 extension/skin/classic/net.css
  83. +1 −0 extension/skin/classic/tableRep.css
  84. +0 −12 extension/skin/classic/win/firebug.css
  85. +2 −0 extension/skin/classic/win/panel.css
  86. +2 −2 extension/update.rdf.tpl.xml
  87. +14 −4 tests/FBTest/content/FBTestFirebug.js
  88. +2 −2 tests/FBTest/content/fbtest.properties
  89. +29 −29 tests/content/commandLine/5130/issue5130.html
  90. +22 −22 tests/content/commandLine/5130/issue5130.js
  91. +75 −75 tests/content/commandLine/api/$x.html
  92. +42 −42 tests/content/commandLine/api/$x.js
  93. +25 −0 tests/content/commandLine/api/dir.html
  94. +97 −0 tests/content/commandLine/api/dir.js
  95. +42 −0 tests/content/commandLine/api/dirxml.html
  96. +20 −0 tests/content/commandLine/api/dirxml.js
  97. +2 −2 tests/content/commandLine/api/monitorEvents.js
  98. +46 −46 tests/content/console/2271/issue2271.html
  99. +34 −34 tests/content/console/3042/issue3042.html
  100. +38 −38 tests/content/console/3042/issue3042.js
  101. +20 −0 tests/content/cookies/5560/issue5560.js
  102. +37 −0 tests/content/cookies/5560/issue5560.php
  103. +31 −31 tests/content/cookies/general/cookiesPanel.html
  104. +14 −14 tests/content/css/2967/issue2967.js
  105. +53 −53 tests/content/css/2967/issue2967.xml
  106. +54 −54 tests/content/css/3303/issue3303.html
  107. +71 −71 tests/content/css/3303/issue3303.js
  108. +50 −50 tests/content/css/5438/issue5438.html
  109. +44 −44 tests/content/css/5438/issue5438.js
  110. +41 −41 tests/content/css/5461/issue5461.html
  111. +42 −42 tests/content/css/5461/issue5461.js
  112. +78 −0 tests/content/css/5644/issue5644.html
  113. +237 −0 tests/content/css/5644/issue5644.js
  114. +43 −0 tests/content/css/computed/4132/issue4132.html
  115. +25 −0 tests/content/css/computed/4132/issue4132.js
  116. +33 −33 tests/content/css/computed/5451/issue5451.html
  117. +20 −20 tests/content/css/computed/5451/issue5451.js
  118. +0 −30 tests/content/dom/2580/issue2580.html
  119. +0 −28 tests/content/dom/2580/issue2580.js
  120. +2 −2 tests/content/dom/5247/external/externalStylesheet.css
  121. +86 −86 tests/content/dom/5247/issue5247.html
  122. +75 −75 tests/content/dom/5247/issue5247.js
  123. +10 −2 tests/content/firebug.html
  124. +33 −33 tests/content/firebug/5349/issue5349.html
  125. +13 −13 tests/content/firebug/5349/issue5349.js
  126. +40 −40 tests/content/html/3296/issue3296.html
  127. +29 −29 tests/content/html/3296/issue3296.js
  128. +5 −16 tests/content/html/4542/issue4542.js
  129. +14 −0 tests/content/html/4670/issue4670.js
  130. +6 −0 tests/content/html/4670/issue4670.xml
  131. +47 −0 tests/content/html/4837/issue4837.html
  132. +23 −0 tests/content/html/4837/issue4837.js
  133. +5 −9 tests/content/html/5755/issue5755.html
  134. +1 −1 tests/content/html/5755/issue5755.js
  135. +30 −30 tests/content/net/4805/issue4805.html
  136. +40 −40 tests/content/net/4805/issue4805.js
  137. +0 −56 tests/content/script/2114/issue2114.html
  138. +0 −37 tests/content/script/2114/issue2114.js
  139. +33 −33 tests/content/script/4724/issue4724.html
  140. +59 −59 tests/content/script/4724/issue4724.js
  141. +61 −0 tests/content/script/breakpoints/4889/issue4889.html
  142. +57 −0 tests/content/script/breakpoints/4889/issue4889.js
  143. +52 −0 tests/content/script/callstack/4845/issue4845.html
  144. +54 −0 tests/content/script/callstack/4845/issue4845.js
  145. +35 −0 tests/content/search/4602/issue4602.html
  146. +31 −0 tests/content/search/4602/issue4602.js
  147. +1 −1 tests/content/search/netPanelSearch.js
  148. +68 −68 tests/templates/default/issueXXXX.html
  149. +25 −25 tests/templates/default/issueXXXX.js
  150. +85 −85 tests/templates/default/issueXXXXSeveralCases.html
  151. +48 −48 tests/templates/default/issueXXXXSeveralCases.js
  152. +142 −142 tests/templates/default/testcase.css
  153. +61 −61 tests/templates/firebugLite/issueXXXX.html
  154. +180 −180 tests/templates/firebugLite/testcase.css
  155. +84 −84 tests/templates/net/issueXXXX.html
  156. +30 −30 tests/templates/net/issueXXXX.js
  157. +3 −3 tests/templates/net/issueXXXX.php
View
4 extension/bootstrap.js
@@ -73,6 +73,7 @@ function startup(params, reason)
// GCLI commands
Cu.import("resource://firebug/gcli.js");
+ FirebugGCLICommands.startup();
}
function shutdown(params, reason)
@@ -94,6 +95,9 @@ function shutdown(params, reason)
Cu.reportError(e);
}
+ // Unregister all GCLI commands
+ FirebugGCLICommands.shutdown();
+
// xxxHonza: I think this shouldn't be here (perhaps in firebug-service.js)
// Shutdown Firebug's JSD debugger service.
var fbs = Cu.import("resource://firebug/firebug-service.js", {}).fbs;
View
2 extension/content/firebug/branch.properties
@@ -1,5 +1,5 @@
# DO NOT MERGE INTO TRUNK
-RELEASE=.0a0
+RELEASE=.0a2
VERSION=1.11
TRUNK=
# To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
View
14 extension/content/firebug/chrome/activation.js
@@ -85,9 +85,12 @@ Firebug.Activation = Obj.extend(Firebug.Module,
var hasAnnotation = Annotations.pageHasAnnotation(uri);
if (FBTrace.DBG_ACTIVATION)
- FBTrace.sysout("shouldCreateContext hasAnnotation "+hasAnnotation +
- " for "+uri.spec+" in "+browser.contentWindow.location +
- " using activateSameOrigin: "+Firebug.activateSameOrigin);
+ {
+ FBTrace.sysout("shouldCreateContext hasAnnotation " + hasAnnotation +
+ " for " + uri.spec + " in " +
+ (browser ? browser.contentWindow.location : "no browser") +
+ " using activateSameOrigin: " + Firebug.activateSameOrigin);
+ }
// Annotated, so return the value.
if (hasAnnotation)
@@ -97,9 +100,12 @@ Firebug.Activation = Obj.extend(Firebug.Module,
{
var dst = browser.FirebugLink.dst;
var dstURI = this.convertToURIKey(dst.spec, Firebug.activateSameOrigin);
+
if (FBTrace.DBG_ACTIVATION)
+ {
FBTrace.sysout("shouldCreateContext found FirebugLink pointing to " +
dstURI.spec, browser.FirebugLink);
+ }
if (dstURI && dstURI.equals(uri)) // and it matches us now
{
@@ -109,8 +115,10 @@ Firebug.Activation = Obj.extend(Firebug.Module,
if (srcURI)
{
if (FBTrace.DBG_ACTIVATION)
+ {
FBTrace.sysout("shouldCreateContext found FirebugLink pointing from " +
srcURI.spec, browser.FirebugLink);
+ }
// and it's on the same domain
if (srcURI.schemeIs("file") || (dstURI.host == srcURI.host))
View
10 extension/content/firebug/chrome/chrome.js
@@ -1376,7 +1376,7 @@ var FirebugChrome =
var sidePanel = panelBar2.selectedPanel;
if (sidePanel)
- sidePanel.select(object);
+ sidePanel.refresh();
}
},
@@ -1511,9 +1511,11 @@ var FirebugChrome =
var realObject = rep ? rep.getRealObject(object, Firebug.currentContext) : null;
var realRep = realObject ? Firebug.getRep(realObject, Firebug.currentContext) : null;
- if (FBTrace.DBG_OPTIONS)
- FBTrace.sysout("chrome.onContextShowing object:"+object+" rep: "+rep+
- " realObject: "+realObject+" realRep:"+realRep);
+ if (FBTrace.DBG_MENU)
+ {
+ FBTrace.sysout("chrome.onContextShowing object:"+object+", rep: "+rep+
+ ", realObject: "+realObject+", realRep:"+realRep);
+ }
if (realObject && realRep)
{
View
56 extension/content/firebug/chrome/menu.js
@@ -4,9 +4,10 @@ define([
"firebug/lib/trace",
"firebug/lib/locale",
"firebug/lib/options",
- "firebug/lib/css"
+ "firebug/lib/css",
+ "firebug/lib/deprecated"
],
-function(FBTrace, Locale, Options, Css) {
+function(FBTrace, Locale, Options, Css, Deprecated) {
// ********************************************************************************************* //
// Constants
@@ -15,23 +16,40 @@ var Menu = {};
// ********************************************************************************************* //
-Menu.createMenu = function(popup, label)
+Menu.createMenu = function(popup, item)
{
+ if (typeof item == "string")
+ {
+ return Deprecated.deprecated("The function's header changed to "+
+ "createMenu(popup, item)",
+ Menu.createMenu, [popup, {label: item}])();
+ }
+
var menu = popup.ownerDocument.createElement("menu");
- menu.setAttribute("label", label);
+
+ Menu.setItemIntoElement(menu, item);
var menuPopup = popup.ownerDocument.createElement("menupopup");
popup.appendChild(menu);
menu.appendChild(menuPopup);
+ if (item.items)
+ {
+ for (var i = 0, len = item.items.length; i < len; ++i)
+ Menu.createMenuItem(menuPopup, item.items[i]);
+ }
+
return menuPopup;
};
Menu.createMenuItem = function(popup, item, before)
{
- if (typeof(item) == "string" && item.charAt(0) == "-")
- return Menu.createMenuSeparator(popup, before);
+ if ((typeof(item) == "string" && item == "-") || item.label == "-")
+ return Menu.createMenuSeparator(popup, item, before);
+
+ if (item.items)
+ return Menu.createMenu(popup, item);
var menuitem = popup.ownerDocument.createElement("menuitem");
@@ -100,6 +118,9 @@ Menu.setItemIntoElement = function(element, item)
if (item.name)
element.setAttribute("name", item.name);
+ if (item.items && (item.command || item.commandID))
+ element.setAttribute("type", "splitmenu");
+
return element;
}
@@ -116,17 +137,30 @@ Menu.createMenuHeader = function(popup, item)
return header;
};
-Menu.createMenuSeparator = function(popup, before)
+Menu.createMenuSeparator = function(popup, item, before)
{
+ if (item instanceof Node)
+ {
+ return Deprecated.deprecated("The function's header changed to "+
+ "createMenuSeparator(popup, item, before)",
+ Menu.createMenuSeparator, [popup, null, before])();
+ }
+
if (!popup.firstChild)
return;
- var menuitem = popup.ownerDocument.createElement("menuseparator");
+ if (FBTrace.DBG_MENU)
+ FBTrace.sysout("createMenuSeparator", {popup: popup, item: item, before: before});
+
+ var menuItem = popup.ownerDocument.createElement("menuseparator");
+ if (typeof item == "object" && item.id)
+ menuItem.setAttribute("id", item.id);
+
if (before)
- popup.insertBefore(menuitem, before);
+ popup.insertBefore(menuItem, before);
else
- popup.appendChild(menuitem);
- return menuitem;
+ popup.appendChild(menuItem);
+ return menuItem;
};
/**
View
13 extension/content/firebug/chrome/panelActivation.js
@@ -8,9 +8,8 @@ define([
"firebug/lib/domplate",
"firebug/lib/url",
"firebug/lib/dom",
- "firebug/js/fbs", // bug712289
],
-function(Obj, Firebug, Firefox, Locale, Domplate, Url, Dom, FBS) {
+function(Obj, Firebug, Firefox, Locale, Domplate, Url, Dom) {
// ************************************************************************************************
// Constants
@@ -334,16 +333,6 @@ Firebug.DisabledPanelBox = domplate(Firebug.Rep,
var parentNode = this.getParentNode(browser);
this.tag.replace(args, parentNode, this);
parentNode.removeAttribute("collapsed");
-
- // bug712289
- if (panelName == "script" && !FBS.isJSDAvailable())
- {
- Dom.hide(parentNode.querySelector(".descImage"), true);
- Dom.hide(parentNode.querySelector(".objectLink"), true);
-
- var desc = parentNode.querySelector(".disabledPanelDescription");
- desc.innerHTML = Locale.$STR("moduleManager.scriptPanelNotAvailable");
- }
},
/**
View
215 extension/content/firebug/chrome/reps.js
@@ -285,6 +285,7 @@ FirebugReps.Func = domplate(Firebug.Rep,
var monitored = scriptInfo ? FBS.fbs.isMonitored(scriptInfo.sourceFile.href,
scriptInfo.lineNo) : false;
+ var self = this;
var name = script ? StackFrame.getFunctionName(script, context) : fn.name;
return [
{
@@ -293,7 +294,11 @@ FirebugReps.Func = domplate(Firebug.Rep,
nol10n: true,
type: "checkbox",
checked: monitored,
- command: Obj.bindFixed(this.monitor, this, fn, monitored)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ self.monitor(fn, !checked);
+ }
},
"-",
{
@@ -671,7 +676,7 @@ FirebugReps.Arr = domplate(Firebug.Rep,
highlightObject: function(object, context, target)
{
- // Highlighting huge amount of elements on the page can cause sericous performance
+ // Highlighting huge amount of elements on the page can cause serious performance
// problems (see issue 4736). So, avoid highlighting if the number of elements in
// the array exceeds specified limit.
var arr = this.getRealObject(object, context);
@@ -710,11 +715,8 @@ FirebugReps.Arr = domplate(Firebug.Rep,
// do this first to avoid security 1000 errors
else if (obj instanceof Ci.nsIDOMHistory)
return false;
- // do this first to avoid security 1000 errors
- else if ("StorageList" in view && obj instanceof view.StorageList)
- return false;
// do this first to avoid exceptions
- else if (obj.toString() === "[xpconnect wrapped native prototype]")
+ else if (obj.toString && obj.toString() === "[xpconnect wrapped native prototype]")
return false;
else if (isFinite(obj.length) && typeof obj.splice === "function")
return true;
@@ -910,14 +912,12 @@ FirebugReps.Element = domplate(Firebug.Rep,
{
try
{
- return elt.getAttribute("class")
- ? ("." + elt.getAttribute("class").split(" ")[0])
- : "";
+ return elt.classList.length > 0 ? ("." + elt.classList[0]) : "";
}
catch (err)
{
+ return "";
}
- return "";
},
getValue: function(elt)
@@ -1111,8 +1111,11 @@ FirebugReps.Element = domplate(Firebug.Rep,
getContextMenuItems: function(elt, target, context)
{
+ // XXX: Temporary fix for issue 5577.
+ if (Dom.getAncestorByClass(target, "cssElementRuleContainer"))
+ return;
+
var type;
- var monitored = EventMonitor.areEventsMonitored(elt, null, context);
var items = [];
if (Xml.isElementHTML(elt) || Xml.isElementXHTML(elt))
@@ -1178,9 +1181,12 @@ FirebugReps.Element = domplate(Firebug.Rep,
tooltiptext: "html.tip.Show_Events_In_Console",
id: "fbShowEventsInConsole",
type: "checkbox",
- checked: monitored,
- command: Obj.bindFixed(EventMonitor.toggleMonitorEvents,
- EventMonitor, elt, null, monitored, context)
+ checked: EventMonitor.areEventsMonitored(elt, null, context),
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ EventMonitor.toggleMonitorEvents(elt, null, !checked, context);
+ }
},
"-",
{
@@ -1591,14 +1597,21 @@ FirebugReps.Window = domplate(Firebug.Rep,
FirebugReps.Event = domplate(Firebug.Rep,
{
- tag: TAG("$copyEventTag", {object: "$object|copyEvent"}),
+ className: "event",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ tag:
+ TAG("$copyEventTag", {object: "$object|copyEvent"}),
copyEventTag:
OBJECTLINK("$object|summarizeEvent"),
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
summarizeEvent: function(event)
{
- var info = [event.type, ' '];
+ var info = [event.type, " "];
var eventFamily = Events.getEventFamily(event.type);
if (eventFamily == "mouse")
@@ -1616,8 +1629,6 @@ FirebugReps.Event = domplate(Firebug.Rep,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
- className: "object",
-
supportsObject: function(object, type)
{
return object instanceof window.Event || object instanceof Dom.EventCopy;
@@ -1631,6 +1642,52 @@ FirebugReps.Event = domplate(Firebug.Rep,
// ********************************************************************************************* //
+FirebugReps.EventLog = domplate(FirebugReps.Event,
+{
+ className: "eventLog",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ tag:
+ TAG("$copyEventTag", {object: "$object|copyEvent"}),
+
+ copyEventTag:
+ SPAN(
+ OBJECTLINK("$object|summarizeEvent"),
+ SPAN("&nbsp"),
+ SPAN("&#187;"),
+ SPAN("&nbsp"),
+ TAG("$object|getTargetTag", {object: "$object|getTarget"})
+ ),
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ copyEvent: function(log)
+ {
+ return new Dom.EventCopy(log.event);
+ },
+
+ getTarget: function(event)
+ {
+ return event.target;
+ },
+
+ getTargetTag: function(event)
+ {
+ var rep = Firebug.getRep(event.target);
+ return rep.shortTag ? rep.shortTag : rep.tag;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ supportsObject: function(object, type)
+ {
+ return object instanceof Firebug.EventMonitor.EventLog;
+ },
+});
+
+// ********************************************************************************************* //
+
FirebugReps.SourceLink = domplate(Firebug.Rep,
{
tag:
@@ -2759,112 +2816,6 @@ FirebugReps.Storage = domplate(Firebug.Rep,
// ********************************************************************************************* //
-FirebugReps.StorageList = domplate(Firebug.Rep,
-{
- tag:
- OBJECTLINK(
- SPAN({"class": "storageTitle"}, "$object|summarize "),
- FOR("prop", "$object|longPropIterator",
- "$prop.name",
- SPAN({"class": "objectEqual", role: "presentation"}, "$prop.equal"),
- TAG("$prop.tag", {object: "$prop.object"}),
- SPAN({"class": "objectComma", role: "presentation"}, "$prop.delim")
- )
- ),
-
- shortTag:
- OBJECTLINK({onclick: "$onClick"},
- SPAN({"class": "storageTitle"}, "$object|summarize "),
- FOR("prop", "$object|shortPropIterator",
- "$prop.name",
- SPAN({"class": "objectEqual", role: "presentation"}, "$prop.equal"),
- TAG("$prop.tag", {object: "$prop.object"}),
- SPAN({"class": "objectComma", role: "presentation"}, "$prop.delim")
- )
- ),
-
- onClick: function(event)
- {
- var globalStorage = event.currentTarget.repObject;
- var context = Firebug.currentContext;
- var domain = context.window.location.hostname;
-
- Firebug.chrome.select(globalStorage.namedItem(domain));
- Events.cancelEvent(event);
- },
-
- summarize: function(globalStorage)
- {
- try
- {
- var context = Firebug.currentContext;
- var domain = context.window.location.hostname;
- var length = globalStorage.namedItem(domain).length;
- return Locale.$STRP("firebug.storage.totalItems", [length]) + " ";
- }
- catch (e)
- {
- if (FBTrace.DBG_ERRORS)
- FBTrace.sysout("reps.StorageList.summarize; EXCEPTION " + e, e);
- }
- return "";
- },
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
- className: "StorageList",
-
- supportsObject: function(object, type)
- {
- return ("StorageList" in window && object instanceof window.StorageList);
- },
-
- getRealObject: function(object, context)
- {
- try
- {
- var domain = context.window.location.hostname;
- return globalStorage.namedItem(domain);
- }
- catch (e)
- {
- if (FBTrace.DBG_ERRORS)
- FBTrace.sysout("reps.StorageList.getRealObject; EXCEPTION " + e, e);
- }
- },
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
- // Iterator
-
- longPropIterator: function(object)
- {
- return this.propIterator(object, 100);
- },
-
- shortPropIterator: function(object)
- {
- return this.propIterator(object, Options.get("ObjectShortIteratorMax"));
- },
-
- propIterator: function(object, max)
- {
- try
- {
- var context = Firebug.currentContext;
- var domain = context.window.location.hostname;
- return FirebugReps.Storage.propIterator(object.namedItem(domain), max);
- }
- catch (e)
- {
- if (FBTrace.DBG_ERRORS)
- FBTrace.sysout("reps.StorageList.propIterator; EXCEPTION " + e, e);
- }
- return [];
- },
-});
-
-// ********************************************************************************************* //
-
FirebugReps.XPathResult = domplate(FirebugReps.Arr,
{
className: "array xPathResult",
@@ -3034,7 +2985,7 @@ FirebugReps.NamedNodeMap = domplate(Firebug.Rep,
),
shortTag:
- OBJECTLINK({onclick: "$onClick"},
+ OBJECTLINK(
SPAN({"class": "arrayLeftBracket", role: "presentation"}, "["),
FOR("prop", "$object|shortPropIterator",
SPAN({"class": "nodeName"}, "$prop.name"),
@@ -3045,16 +2996,6 @@ FirebugReps.NamedNodeMap = domplate(Firebug.Rep,
SPAN({"class": "arrayRightBracket", role: "presentation"}, "]")
),
- onClick: function(event)
- {
- var globalStorage = event.currentTarget.repObject;
- var context = Firebug.currentContext;
- var domain = context.window.location.hostname;
-
- Firebug.chrome.select(globalStorage.namedItem(domain));
- Events.cancelEvent(event);
- },
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
className: "NamedNodeMap",
@@ -3207,11 +3148,11 @@ Firebug.registerRep(
FirebugReps.Arr,
FirebugReps.XPathResult,
FirebugReps.Storage,
- FirebugReps.StorageList,
FirebugReps.Attr,
FirebugReps.Date,
FirebugReps.NamedNodeMap,
- FirebugReps.Reference
+ FirebugReps.Reference,
+ FirebugReps.EventLog
);
Firebug.setDefaultReps(FirebugReps.Func, FirebugReps.Obj);
View
2 extension/content/firebug/chrome/tabContext.js
@@ -215,7 +215,7 @@ Firebug.TabContext.prototype =
// to iframes (documents), which can be already unloaded at this point.
// Removing listeners from such 'unloaded' documents (or window) can throw
// "TypeError: can't access dead object"
- // We should avoid these exceptions (event if they are not representing mem leaks)
+ // We should avoid these exceptions (even if they are not representing memory leaks)
this.unregisterAllListeners();
state.panelState = {};
View
47 extension/content/firebug/console/commandHistory.js
@@ -24,7 +24,7 @@ Firebug.CommandHistory = function()
const commandHistoryMax = 1000;
var commandsPopup = Firebug.chrome.$("fbCommandHistory");
- var commands = [];
+ var commands = this.commands = [];
var commandPointer = 0;
var commandInsertPointer = -1;
@@ -78,25 +78,21 @@ Firebug.CommandHistory = function()
var command;
var commandLine = Firebug.CommandLine.getCommandLine(context);
- if (dir < 0)
- {
- if (commandPointer > 0)
- commandPointer--;
- }
- else
- {
- if (commandPointer < commands.length)
- commandPointer++;
- }
+ commandPointer += dir;
+ if (commandPointer < 0)
+ commandPointer = 0;
+ else if (commandPointer > commands.length)
+ commandPointer = commands.length;
if (commandPointer < commands.length)
{
command = commands[commandPointer];
if (commandsPopup.state == "open")
{
- var commandElements = commandsPopup.ownerDocument.getElementsByClassName(
- "commandHistoryItem");
- this.selectCommand(commandElements[commandPointer]);
+ var commandElement = commandsPopup.children[commandPointer];
+ this.selectCommand(commandElement);
+
+ Dom.scrollMenupopup(commandsPopup, commandElement);
}
}
else
@@ -119,40 +115,42 @@ Firebug.CommandHistory = function()
this.show = function(element)
{
if (this.isShown())
- return this.hide;
+ return this.hide();
Dom.eraseNode(commandsPopup);
if(commands.length == 0)
return;
- var vbox = commandsPopup.ownerDocument.createElement("vbox");
+ var doc = commandsPopup.ownerDocument;
for (var i = 0; i < commands.length; i++)
{
- var hbox = commandsPopup.ownerDocument.
- createElementNS("http://www.w3.org/1999/xhtml", "div");
+ var hbox = doc.createElementNS("http://www.w3.org/1999/xhtml", "div");
hbox.classList.add("commandHistoryItem");
var shortExpr = Str.cropString(Str.stripNewLines(commands[i]), 50);
hbox.innerHTML = Str.escapeForTextNode(shortExpr);
hbox.value = i;
- vbox.appendChild(hbox);
+ commandsPopup.appendChild(hbox);
if (i === commandPointer)
this.selectCommand(hbox);
}
- commandsPopup.appendChild(vbox);
commandsPopup.openPopup(element, "before_start", 0, 0, false, false);
+ // make sure last element is visible
+ setTimeout(Dom.scrollMenupopup, 10, commandsPopup, hbox);
+ this.isOpen = true;
+
return true;
};
this.hide = function()
{
commandsPopup.hidePopup();
-
+ this.isOpen = false;
return true;
};
@@ -186,9 +184,13 @@ Firebug.CommandHistory = function()
this.onMouseUp = function(event)
{
+ var i = event.target.value;
+ if (i == undefined)
+ return;
+
var commandLine = Firebug.CommandLine.getCommandLine(Firebug.currentContext);
- commandLine.value = commands[event.target.value];
+ commandLine.value = commands[i];
commandPointer = event.target.value;
Firebug.CommandLine.commandHistory.hide();
@@ -198,6 +200,7 @@ Firebug.CommandHistory = function()
{
Firebug.chrome.setGlobalAttribute("fbCommandLineHistoryButton", "checked", "false");
Firebug.chrome.setGlobalAttribute("fbCommandEditorHistoryButton", "checked", "false");
+ this.isOpen = false;
};
};
View
10 extension/content/firebug/console/commandLine.js
@@ -450,6 +450,10 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
if (noscript && noScriptURI)
noscript.setJSEnabled(noScriptURI, false);
+
+ var consolePanel = Firebug.currentContext.panelMap.console;
+ if (consolePanel)
+ Dom.scrollToBottom(consolePanel.panelNode);
},
enterInspect: function(context)
@@ -874,15 +878,17 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
this.commandHistory.hide();
return true;
}
-
+ if (this.commandHistory.isOpen && !event.metaKey && !event.ctrlKey && !event.altKey)
+ this.commandHistory.hide();
return false;
},
onCommandLineInput: function(event)
{
var context = Firebug.currentContext;
- if (!this.commandHistory.isShown())
+ var commandEditorOpen = (Firebug.commandEditor && context.panelName == "console");
+ if (!this.commandHistory.isShown() && !commandEditorOpen)
{
this.autoCompleter.complete(context);
}
View
4 extension/content/firebug/console/commandLineExposed.js
@@ -71,6 +71,8 @@ function createFirebugCommandLine(context, win)
commandLine.__exposedProps__[command] = "rw";
}
+ var console = Firebug.ConsoleExposed.createFirebugConsole(context, win);
+
// Define shortcuts for some console methods
for (var i=0; i<consoleShortcuts.length; i++)
{
@@ -82,7 +84,7 @@ function createFirebugCommandLine(context, win)
function createShortcutHandler(cmd) {
return function() {
- return contentView.console[cmd].apply(contentView.console, arguments);
+ return console[cmd].apply(console, arguments);
}
}
View
17 extension/content/firebug/console/console.js
@@ -13,6 +13,7 @@ define([
"firebug/chrome/searchBox",
"firebug/console/consolePanel",
"firebug/console/commandEditor",
+ "firebug/console/functionMonitor",
],
function(Obj, Firebug, Firefox, Events, Win, Search, Xml, Options) {
@@ -405,22 +406,6 @@ Firebug.Console = Obj.extend(ActivableConsole,
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
- // Firebug.Debugger listener
-
- onMonitorScript: function(context, frame)
- {
- Firebug.Console.log(frame, context);
- },
-
- onFunctionCall: function(context, frame, depth, calling)
- {
- if (calling)
- Firebug.Console.openGroup([frame, "depth:"+depth], context);
- else
- Firebug.Console.closeGroup(context);
- },
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// BTI
/**
View
15 extension/content/firebug/console/consolePanel.js
@@ -155,12 +155,12 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
if (state)
wasScrolledToBottom = state.wasScrolledToBottom;
- if (typeof(wasScrolledToBottom) == "boolean")
+ if (typeof wasScrolledToBottom == "boolean")
{
this.wasScrolledToBottom = wasScrolledToBottom;
delete state.wasScrolledToBottom;
}
- else
+ else if (typeof this.wasScrolledToBottom != "boolean")
{
// If the previous state doesn't says where to scroll,
// scroll to the bottom by default.
@@ -250,8 +250,8 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
"console.option.tip.Show_JavaScript_Warnings"),
Menu.optionMenu("ShowCSSErrors", "showCSSErrors",
"console.option.tip.Show_CSS_Errors"),
- Menu.optionMenu("ShowXMLErrors", "showXMLErrors",
- "console.option.tip.Show_XML_Errors"),
+ Menu.optionMenu("ShowXMLHTMLErrors", "showXMLErrors",
+ "console.option.tip.Show_XML_HTML_Errors"),
Menu.optionMenu("ShowXMLHttpRequests", "showXMLHttpRequests",
"console.option.tip.Show_XMLHttpRequests"),
Menu.optionMenu("ShowChromeErrors", "showChromeErrors",
@@ -294,8 +294,11 @@ Firebug.ConsolePanel.prototype = Obj.extend(Firebug.ActivablePanel,
type: "checkbox",
checked: strictValue,
tooltiptext: "console.option.tip.Show_Strict_Warnings",
- command: Obj.bindFixed(Options.setPref, Options,
- strictDomain, strictName, !strictValue)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ Options.setPref(strictDomain, strictName, checked);
+ }
};
},
View
12 extension/content/firebug/console/errors.js
@@ -371,8 +371,12 @@ var Errors = Firebug.Errors = Obj.extend(Firebug.Module,
correctLineNumbersOnExceptions(object, error);
}
- if (Firebug.showStackTrace && Firebug.errorStackTrace)
+ if (Firebug.errorStackTrace)
+ {
error.correctWithStackTrace(Firebug.errorStackTrace);
+ if (!Firebug.showStackTrace)
+ error.trace = null;
+ }
var msgId = lessTalkMoreAction(context, object, isWarning);
if (!msgId)
@@ -666,6 +670,7 @@ const categoryMap =
"DOM": "js",
"Events": "js",
"CSS": "css",
+ "HTML": "xml",
"XML": "xml",
"malformed-xml": "xml"
};
@@ -704,9 +709,10 @@ function whyNotShown(url, categoryList, isWarning)
{
return "showCSSErrors";
}
- else if ((category == "XML" || category == "malformed-xml" ) && !Firebug.showXMLErrors)
+ else if ((category == "HTML" || category == "XML" || category == "malformed-xml" ) &&
+ !Firebug.showXMLErrors)
{
- return "showXMLErors";
+ return "showXMLErrors";
}
else if ((category == "javascript" || category == "JavaScript" || category == "DOM")
&& !isWarning && !Firebug.showJSErrors)
View
39 extension/content/firebug/console/eventMonitor.js
@@ -52,7 +52,12 @@ Firebug.EventMonitor = Obj.extend(Firebug.Module,
if (object && object.addEventListener)
{
if (!context.onMonitorEvent)
- context.onMonitorEvent = function(event) { Firebug.Console.log(event, context); };
+ {
+ var self = this;
+ context.onMonitorEvent = function(event) {
+ self.onMonitorEvent(event, context);
+ };
+ }
if (!context.eventsMonitored)
context.eventsMonitored = [];
@@ -88,7 +93,7 @@ Firebug.EventMonitor = Obj.extend(Firebug.Module,
if (eventsMonitored[j].object == object && eventsMonitored[j].type == eventTypes[i])
{
eventsMonitored.splice(j, 1);
-
+
Events.removeEventListener(object, eventTypes[i], context.onMonitorEvent, false);
break;
}
@@ -127,22 +132,44 @@ Firebug.EventMonitor = Obj.extend(Firebug.Module,
if (!monitored)
{
if (FBTrace.DBG_EVENTS)
- FBTrace.sysout("EventMonitor.areEventsMonitored - Events not monitored for '"+eventTypes[i]+"'");
-
+ {
+ FBTrace.sysout("EventMonitor.areEventsMonitored - Events not monitored for '" +
+ eventTypes[i] + "'");
+ }
+
return false;
}
else
{
if (FBTrace.DBG_EVENTS)
- FBTrace.sysout("EventMonitor.areEventsMonitored - Events monitored for '"+eventTypes[i]+"'");
+ {
+ FBTrace.sysout("EventMonitor.areEventsMonitored - Events monitored for '" +
+ eventTypes[i] + "'");
+ }
}
}
return true;
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Logging
+
+ onMonitorEvent: function(event, context)
+ {
+ var obj = new Firebug.EventMonitor.EventLog(event);
+ Firebug.Console.log(obj, context);
}
});
-//********************************************************************************************* //
+// ********************************************************************************************* //
+
+Firebug.EventMonitor.EventLog = function(event)
+{
+ this.event = event;
+}
+
+// ********************************************************************************************* //
// Helpers
function getMonitoredEventTypes(types)
View
191 extension/content/firebug/console/functionMonitor.js
@@ -0,0 +1,191 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/lib/trace",
+ "firebug/lib/object",
+ "firebug/lib/domplate",
+ "firebug/chrome/reps",
+ "firebug/js/stackFrame",
+ "firebug/lib/events",
+ "firebug/lib/css",
+ "firebug/lib/dom",
+ "firebug/lib/url",
+],
+function(FBTrace, Obj, Domplate, Reps, StackFrame, Events, Css, Dom, Url) { with (Domplate) {
+
+// ********************************************************************************************* //
+// Function Monitor
+
+var FunctionMonitor = Obj.extend(Firebug.Module,
+{
+ dispatchName: "functionMonitor",
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Module
+
+ initialize: function()
+ {
+ Firebug.Module.initialize.apply(this, arguments);
+ Firebug.connection.addListener(this);
+ },
+
+ shutdown: function()
+ {
+ Firebug.connection.removeListener(this);
+ Firebug.Module.shutdown.apply(this, arguments);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Firebug.Debugger listener
+
+ onMonitorScript: function(context, frame)
+ {
+ var stackTrace = StackFrame.buildStackTrace(frame);
+ Firebug.Console.log(new FunctionLog(frame, stackTrace), context);
+ },
+
+ onFunctionCall: function(context, frame, depth, calling)
+ {
+ //var url = Url.normalizeURL(frame.script.fileName);
+ //var sourceFile = context.sourceFileMap[url];
+ // Firebug.errorStackTrace = StackFrame.getCorrectedStackTrace(frame, context);
+ //var sourceFile = Firebug.SourceFile.getSourceFileByScript(context, frame.script);
+ if (Url.isSystemURL(Url.normalizeURL(frame.script.fileName)))
+ return;
+
+ // xxxHonza: traceCall and traceCallAll need to be fixed yet.
+ FBTrace.sysout("functionMonitor.onFunctionCall; ", sourceFile);
+
+ if (calling)
+ Firebug.Console.openGroup([frame, "depth:" + depth], context);
+ else
+ Firebug.Console.closeGroup(context);
+ },
+});
+
+// ********************************************************************************************* //
+// Rep Object
+
+function FunctionLog(frame, stackTrace)
+{
+ this.frame = frame;
+ this.stackTrace = stackTrace;
+}
+
+// ********************************************************************************************* //
+// Function Monitor Rep
+
+var FunctionMonitorRep = domplate(Firebug.Rep,
+{
+ className: "functionCall",
+
+ tag:
+ Reps.OBJECTBLOCK({$hasTwisty: "$object|hasStackTrace", _repObject: "$object",
+ onclick: "$onToggleStackTrace"},
+ A({"class": "objectLink functionCallTitle a11yFocus", _repObject: "$object"},
+ "$object|getCallName"
+ ),
+ SPAN("("),
+ SPAN({"class": "arguments"},
+ FOR("arg", "$object|argIterator",
+ SPAN({"class": "argName"}, "$arg.name"),
+ SPAN("="),
+ TAG("$arg.tag", {object: "$arg.value"}),
+ SPAN({"class": "arrayComma"}, "$arg.delim")
+ )
+ ),
+ SPAN(")"),
+ SPAN({"class": "objectLink-sourceLink objectLink a11yFocus",
+ _repObject: "$object|getSourceLink",
+ role: "link"},
+ "$object|getSourceLinkTitle"),
+ DIV({"class": "stackTrace"})
+ ),
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ hasStackTrace: function(object)
+ {
+ return true;
+ },
+
+ getTitle: function(object)
+ {
+ return object.frame.getFunctionName();
+ },
+
+ getCallName: function(object)
+ {
+ return this.getTitle(object);
+ },
+
+ getSourceLink: function(object)
+ {
+ return Reps.StackFrame.getSourceLink(object.frame);
+ },
+
+ getSourceLinkTitle: function(object)
+ {
+ return Reps.StackFrame.getSourceLinkTitle(object.frame);
+ },
+
+ argIterator: function(object)
+ {
+ return Reps.StackFrame.argIterator(object.frame);
+ },
+
+ onToggleStackTrace: function(event)
+ {
+ var target = event.originalTarget;
+
+ // Only clicking on the expand button or the function title actually expands
+ // the function call log. All other clicks keep default behavior
+ if (!(Css.hasClass(target, "objectBox-functionCall") ||
+ Css.hasClass(target, "functionCallTitle")))
+ {
+ return;
+ }
+
+ var objectBox = Dom.getAncestorByClass(target, "objectBox-functionCall");
+ if (!objectBox)
+ return;
+
+ var traceBox = objectBox.getElementsByClassName("stackTrace").item(0);
+ Css.toggleClass(traceBox, "opened");
+
+ if (Css.hasClass(traceBox, "opened"))
+ {
+ var functionCall = objectBox.repObject;
+ Reps.StackTrace.tag.append({object: functionCall.stackTrace}, traceBox);
+ }
+ else
+ {
+ Dom.clearNode(traceBox);
+ }
+
+ Events.cancelEvent(event);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ supportsObject: function(object, type)
+ {
+ return object instanceof FunctionLog;
+ },
+
+ getRealObject: function(object)
+ {
+ return object.frame;
+ },
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(FunctionMonitor);
+Firebug.registerRep(FunctionMonitorRep);
+
+return FunctionMonitor;
+
+// ********************************************************************************************* //
+}});
View
13 extension/content/firebug/cookies/cookie.js
@@ -3,6 +3,7 @@
define([
"firebug/lib/xpcom",
"firebug/lib/json",
+ "firebug/lib/string",
],
function(Xpcom, Json) {
@@ -140,7 +141,17 @@ Cookie.prototype =
}
return null;
- }
+ },
+
+ getSize: function()
+ {
+ return this.cookie.name.length + this.cookie.value.length;
+ },
+
+ getRawSize: function()
+ {
+ return this.cookie.name.length + this.cookie.rawValue.length
+ },
};
// ********************************************************************************************* //
View
46 extension/content/firebug/cookies/cookieModule.js
@@ -676,45 +676,29 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
return true;
},
- onRemoveAllShared: function(context, sessionOnly)
+ removeCookies: function(context, filter)
{
var panel = context.getPanel(panelName, true);
if (!panel)
return;
- var cookies = [];
-
- // Remove all cookies in the list. Notice that the list can be further
- // filtered by the search-box (the right side of Firebug's tab bar)
- // So, make sure in case of searching-on, only visible (matched)
- // cookies are removed.
- var searching = Css.hasClass(panel.panelNode, "searching");
- var row = Dom.getElementByClass(panel.panelNode, "cookieRow");
- while (row)
+ FBTrace.sysout("cookies", {ctx: context, activeHosts: context.cookies.activeHosts.length});
+ for (var host in context.cookies.activeHosts)
{
- if (!searching || Css.hasClass(row, "matched"))
- {
- var cookie = row.repObject;
+ var cookieEnumerator = cookieManager.getCookiesFromHost(host);
- // Some entries within the Cookies panel don't represent a cookie.
- if (cookie)
- {
- // If sessionOnly flag is true, only session cookies will be removed.
- if (sessionOnly)
- {
- if (!cookie.cookie.expires)
- cookies.push(cookie);
- }
- else
- cookies.push(cookie);
- }
+ while(cookieEnumerator.hasMoreElements())
+ {
+ var cookie = cookieEnumerator.getNext();
+ cookie = cookie.QueryInterface(Ci.nsICookie2);
+ FBTrace.sysout("cookie " + cookie.name + ", " + cookie.host, cookie);
+ var sessionCookieToRemove = typeof filter.session != "undefined" && filter.session &&
+ cookie.isSession;
}
-
- row = row.nextSibling;
}
- for (var i=0; i<cookies.length; i++)
- CookieReps.CookieRow.onRemove(cookies[i]);
+ /*for (var i=0; i<cookies.length; i++)
+ CookieReps.CookieRow.onRemove(cookies[i]);*/
},
onRemoveAll: function(context)
@@ -737,7 +721,7 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
Options.set(removeConfirmation, !check.value);
}
- Firebug.CookieModule.onRemoveAllShared(context, false);
+ Firebug.CookieModule.removeCookies(context, false);
},
onRemoveAllSession: function(context)
@@ -760,7 +744,7 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
Options.set(removeSessionConfirmation, !check.value)
}
- Firebug.CookieModule.onRemoveAllShared(context, true);
+ Firebug.CookieModule.removeCookies(context, true);
},
onCreateCookieShowTooltip: function(tooltip, context)
View
28 extension/content/firebug/cookies/cookiePanel.js
@@ -481,6 +481,34 @@ CookiePanel.prototype = Obj.extend(Firebug.ActivablePanel,
Firebug.Console.removeListener(Firebug.CookieModule.ConsoleListener);
}
},
+
+ // Support for info tips.
+ showInfoTip: function(infoTip, target, x, y)
+ {
+ var row = Dom.getAncestorByClass(target, "cookieRow");
+ if (row && row.repObject)
+ {
+ if (Dom.getAncestorByClass(target, "cookieSizeCol"))
+ {
+ var infoTipCookieId = "cookiesize-"+row.repObject.name;
+ if (infoTipCookieId == this.infoTipCookieId && row.repObject == this.infoTipCookie)
+ return true;
+
+ this.infoTipCookieId = infoTipCookieId;
+ this.infoTipCookie = row.repObject;
+ return this.populateSizeInfoTip(infoTip, row.repObject);
+ }
+ }
+
+ delete this.infoTipCookieId;
+ return false;
+ },
+
+ populateSizeInfoTip: function(infoTip, cookie)
+ {
+ CookieReps.SizeInfoTip.render(cookie, infoTip);
+ return true;
+ },
});
// ********************************************************************************************* //
View
58 extension/content/firebug/cookies/cookieReps.js
@@ -236,19 +236,7 @@ CookieReps.CookieRow = domplate(CookieReps.Rep,
getSize: function(cookie)
{
var size = cookie.cookie.name.length + cookie.cookie.value.length;
- return this.formatSize(size);
- },
-
- formatSize: function(bytes)
- {
- if (bytes == -1 || bytes == undefined)
- return "?";
- else if (bytes < 1024)
- return bytes + " B";
- else if (bytes < 1024*1024)
- return Math.ceil(bytes/1024) + " KB";
- else
- return (Math.ceil(bytes/1024)/1024) + " MB"; // OK, this is probable not necessary ;-)
+ return Str.formatSize(size);
},
getPath: function(cookie)
@@ -940,6 +928,50 @@ CookieReps.CookieCleared = domplate(CookieReps.Rep,
}
});
+
+CookieReps.SizeInfoTip = domplate(Firebug.Rep,
+{
+ tag:
+ TABLE({"class": "sizeInfoTip", "id": "cookiesSizeInfoTip", role:"presentation"},
+ TBODY(
+ FOR("size", "$sizeInfo",
+ TAG("$size|sizeTag", {size: "$size"})
+ )
+ )
+ ),
+
+ sizeTag:
+ TR({"class": "sizeInfoRow"},
+ TD({"class": "sizeInfoLabelCol"}, "$size.label"),
+ TD({"class": "sizeInfoSizeCol"}, "$size|formatSize"),
+ TD({"class": "sizeInfoDetailCol"}, "$size|formatNumber")
+ ),
+
+ formatSize: function(size)
+ {
+ return Str.formatSize(size.size);
+ },
+
+ formatNumber: function(size)
+ {
+ return size.size && size.size >= 1024 ? "(" + Str.formatNumber(size.size) + " B)" : "";
+ },
+
+ render: function(cookie, parentNode)
+ {
+ var size = cookie.getSize();
+ var rawSize = cookie.getRawSize();
+ var sizeInfo = [];
+
+ sizeInfo.push({label: Locale.$STR("cookie.sizeinfo.Size"), size: size});
+
+ if (size != rawSize)
+ sizeInfo.push({label: Locale.$STR("cookie.sizeinfo.Raw_Size"), size: rawSize});
+
+ this.tag.replace({sizeInfo: sizeInfo}, parentNode);
+ },
+});
+
// ********************************************************************************************* //
// Header Template (domplate)
View
10 extension/content/firebug/cookies/cookieUtils.js
@@ -36,9 +36,17 @@ var CookieUtils =
if (value)
value = value.replace(/\+/g, " ");
+ value = unescape(value);
+
+ try
+ {
+ value = Str.convertToUnicode(value);
+ }
+ catch (exc) { }
+
var c = {
name : cookie.name,
- value : Str.convertToUnicode(unescape(value)),
+ value : value,
isDomain : cookie.isDomain,
host : cookie.host,
path : cookie.path,
View
8 extension/content/firebug/cookies/menuUtils.js
@@ -13,13 +13,17 @@ var MenuUtils =
{
optionMenu: function(context, label, tooltiptext, domain, option)
{
- var value = Options.getPref(domain, option);
+ var value = Options.getPref(domain, option), self = this;
return {
label: label,
tooltiptext: tooltiptext,
type: "checkbox",
checked: value,
- command: Obj.bindFixed(this.setPref, this, domain, option, !value)
+ command: function()
+ {
+ var checked = this.hasAttribute("checked");
+ self.setPref(domain, option, checked);
+ }
};
},
View
3 extension/content/firebug/css/computedPanel.js
@@ -670,6 +670,7 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
return CSSInfoTip.populateImageInfoTip(infoTip, absURL, repeat);
}
+ break;
case "fontFamily":
return CSSInfoTip.populateFontFamilyInfoTip(infoTip, cssValue.value);
@@ -678,6 +679,8 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
delete this.infoTipType;
delete this.infoTipValue;
delete this.infoTipObject;
+
+ return false;
}
},
View
38 extension/content/firebug/css/cssModule.js
@@ -27,7 +27,7 @@ const reRepeat = /no-repeat|repeat-x|repeat-y|repeat/;
// ********************************************************************************************* //
// CSS Module
-Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector),
+Firebug.CSSModule = Obj.extend(Firebug.Module, Firebug.EditorSelector,
{
dispatchName: "cssModule",
@@ -87,15 +87,27 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
return insertIndex;
},
- deleteRule: function(styleSheet, ruleIndex)
+ deleteRule: function(src, ruleIndex)
{
if (FBTrace.DBG_CSS)
- FBTrace.sysout("deleteRule: " + ruleIndex + " " + styleSheet.cssRules.length,
- styleSheet.cssRules);
+ {
+ if (src instanceof window.Element)
+ {
+ FBTrace.sysout("deleteRule: element.style", src);
+ }
+ else
+ {
+ FBTrace.sysout("deleteRule: " + ruleIndex + " " + src.cssRules.length,
+ styleSheet.cssRules);
+ }
+ }
- Events.dispatch(this.fbListeners, "onCSSDeleteRule", [styleSheet, ruleIndex]);
+ Events.dispatch(this.fbListeners, "onCSSDeleteRule", [src, ruleIndex]);
- styleSheet.deleteRule(ruleIndex);
+ if (src instanceof window.Element)
+ src.removeAttribute("style");
+ else
+ src.deleteRule(ruleIndex);
},
setProperty: function(rule, propName, propValue, propPriority)
@@ -192,7 +204,7 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
cleanupSheets: function(doc, context)
{
if (!context)
- return;
+ return false;
// Due to the manner in which the layout engine handles multiple
// references to the same sheet we need to kick it a little bit.
@@ -220,6 +232,8 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
}
}*/
+ var result = true;
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=500365
// This voodoo touches each style sheet to force some Firefox internal change
// to allow edits.
@@ -238,11 +252,17 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
}
catch(e)
{
+ result = false;
+
if (FBTrace.DBG_ERRORS)
- FBTrace.sysout("css.show: sheet.cssRules FAILS for "+
- (styleSheets[i]?styleSheets[i].href:"null sheet")+e, e);
+ FBTrace.sysout("css.show: sheet.cssRules FAILS for " +
+ (styleSheets[i] ? styleSheets[i].href : "null sheet") + e, e);
}
}
+
+ // Return true only if all stylesheets are fully loaded and there is no
+ // excpetion when accessing them.
+ return result;
},
cleanupSheetHandler: function(event, context)
View
215 extension/content/firebug/css/cssPanel.js
@@ -167,12 +167,12 @@ var CSSStyleRuleTag = domplate(CSSDomplateBase,
$insertInto: "$rule|isEditable",
$editGroup: "$rule|isSelectorEditable",
_repObject: "$rule.rule",
- "ruleId": "$rule.id", role: "presentation"},
+ role: "presentation"},
DIV({"class": "cssHead focusRow", role: "listitem"},
SPAN({"class": "cssSelector", $editable: "$rule|isSelectorEditable"},
"$rule.selector"),
- " {"
- ),
+ " {"
+ ),
DIV({role: "group"},
DIV({"class": "cssPropertyListBox", _rule: "$rule", role: "listbox"},
FOR("prop", "$rule.props",
@@ -393,7 +393,7 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
var rules = [];
var appendRules = function(cssRules)
{
- var i, props, ruleId;
+ var i, props;
if (!cssRules)
return;
@@ -404,14 +404,10 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
if (rule instanceof window.CSSStyleRule)
{
props = this.getRuleProperties(context, rule);
- ruleId = this.getRuleId(rule);
rules.push({
tag: CSSStyleRuleTag.tag,
rule: rule,
- id: ruleId,
- // Show universal selectors with pseudo-class
- // (http://code.google.com/p/fbug/issues/detail?id=3683)
- selector: rule.selectorText.replace(/ :/g, " *:"),
+ selector: rule.selectorText.replace(/ :/g, " *:"), // (issue 3683)
props: props,
isSystemSheet: isSystemSheet,
isSelectorEditable: true
@@ -518,29 +514,42 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
{
var props = this.parseCSSProps(rule.style, inheritMode);
- var ruleId = this.getRuleId(rule);
- this.addOldProperties(context, ruleId, inheritMode, props);
+ this.addDisabledProperties(context, rule, inheritMode, props);
this.sortProperties(props);
return props;
},
- addOldProperties: function(context, ruleId, inheritMode, props)
+ addDisabledProperties: function(context, rule, inheritMode, props)
{
- if (context.selectorMap && context.selectorMap.hasOwnProperty(ruleId) )
+ var disabledMap = this.getDisabledMap(context);
+ var moreProps = disabledMap.get(rule);
+ if (moreProps)
{
- var moreProps = context.selectorMap[ruleId];
+ var propMap = {};
+ for (var i = 0; i < props.length; ++i)
+ propMap[props[i].name] = true;
+
for (var i = 0; i < moreProps.length; ++i)
{
var prop = moreProps[i];
+ if (propMap.hasOwnProperty(prop.name))
+ {
+ // A (probably enabled) property with the same name as this
+ // disabled one has appeared - remove this one entirely.
+ moreProps.splice(i, 1);
+ --i;
+ continue;
+ }
+ propMap[prop.name] = true;
this.addProperty(prop.name, prop.value, prop.important, true, inheritMode, props);
}
}
},
addProperty: function(name, value, important, disabled, inheritMode, props)
{
- if (inheritMode && !Css.inheritedStyleNames[name])
+ if (inheritMode && !Dom.domUtils.isInheritedProperty(name))
return;
name = this.translateName(name, value);
@@ -596,6 +605,22 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ getDisabledMap: function(context)
+ {
+ // Ideally, we'd use a WeakMap here, but WeakMaps don't allow CSS rules
+ // as keys before Firefox 17. A Map is used instead. (cf. bug 777373.)
+ if (!context.cssDisabledMap)
+ context.cssDisabledMap = new Map();
+ return context.cssDisabledMap;
+ },
+
+ remapRule: function(context, oldRule, newRule)
+ {
+ var map = this.getDisabledMap(context);
+ if (map.has(oldRule))
+ map.set(newRule, map.get(oldRule));
+ },
+
editElementStyle: function()
{
var rulesBox = this.panelNode.getElementsByClassName("cssElementRuleContainer")[0];
@@ -729,22 +754,13 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
{
var rule = Firebug.getRepObject(row);
var propName = Dom.getChildByClass(row, "cssPropName").textContent;
- CSSModule.deleteProperty(rule, propName, this.context);
- // Remove the property from the selector map, if it was disabled
- var ruleId = Firebug.getRepNode(row).getAttribute("ruleId");
- if ( this.context.selectorMap && this.context.selectorMap.hasOwnProperty(ruleId) )
- {
- var map = this.context.selectorMap[ruleId];
- for (var i = 0; i < map.length; ++i)
- {
- if (map[i].name == propName)
- {
- map.splice(i, 1);
- break;
- }
- }
- }
+ // Try removing the property from the "disabled" map.
+ var wasDisabled = this.removeDisabledProperty(rule, propName);
+
+ // If that fails, remove the actual property instead.
+ if (!wasDisabled)
+ CSSModule.deleteProperty(rule, propName, this.context);
if (this.name == "stylesheet")
Events.dispatch(this.fbListeners, "onInlineEditorClose", [this, row.firstChild, true]);
@@ -753,22 +769,35 @@ Firebug.CSSStyleSheetPanel.prototype = Obj.extend(Firebug.Panel,
this.markChange(this.name == "stylesheet");
},
+ removeDisabledProperty: function(rule, propName)
+ {
+ var disabledMap = this.getDisabledMap(this.context);
+ var map = disabledMap.get(rule);
+ if (!map)
+ return false;
+ for (var i = 0; i < map.length; ++i)
+ {
+ if (map[i].name === propName)
+ {
+ map.splice(i, 1);
+ return true;
+ }
+ }
+ return false;
+ },
+
disablePropertyRow: function(row)
{
Css.toggleClass(row, "disabledStyle");
var rule = Firebug.getRepObject(row);
var propName = Dom.getChildByClass(row, "cssPropName").textContent;
- if (!this.context.selectorMap)
- this.context.selectorMap = {};
-
- // XXXjoe Generate unique key for elements too
- var ruleId = Firebug.getRepNode(row).getAttribute("ruleId");
- if (!(this.context.selectorMap.hasOwnProperty(ruleId)))
- this.context.selectorMap[ruleId] = [];
+ var disabledMap = this.getDisabledMap(this.context);
+