Permalink
Browse files

Merge branch 'master' of github.com:firebug/firebug

  • Loading branch information...
2 parents 6fb6dda + a918cd6 commit 687269111f6dc74ba01fc8bf5f47a0681f5b9a67 @janodvarko janodvarko committed Oct 9, 2012
@@ -1,5 +1,5 @@
# DO NOT MERGE INTO TRUNK
-RELEASE=.0a3
+RELEASE=.0a4
VERSION=1.11
TRUNK=
# To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
@@ -773,9 +773,18 @@ var TabWatchListener =
}
var browser = context.browser;
+
// Persist remnants of the context for restoration if the user reloads
- browser.panelName = context.panelName;
- browser.sidePanelNames = context.sidePanelNames;
+ try
+ {
+ browser.panelName = context.panelName;
+ browser.sidePanelNames = context.sidePanelNames;
+ }
+ catch (e)
+ {
+ if (FBTrace.DBG_ERRORS)
+ FBTrace.sysout("browser.destroyContext; " + e, e);
+ }
// next the context is deleted and removed from the Firebug.TabWatcher,
// we clean up in unWatchBrowser
@@ -1,15 +1,16 @@
/* See license.txt for terms of usage */
define([
+ "firebug/firebug",
"firebug/lib/domplate",
"firebug/lib/locale",
"firebug/lib/dom",
"firebug/console/commandLineExposed",
"firebug/chrome/window",
- "firebug/lib/Xpcom",
+ "firebug/lib/xpcom",
"firebug/lib/events",
],
-function(Domplate, Locale, Dom, CommandLineExposed, Win, Xpcom, Events) {
+function(Firebug, Domplate, Locale, Dom, CommandLineExposed, Win, Xpcom, Events) {
with (Domplate) {
// ********************************************************************************************* //
@@ -100,6 +100,10 @@ var CookieClipboard = Obj.extend(Object,
{
var trans = Xpcom.CCIN("@mozilla.org/widget/transferable;1", "nsITransferable");
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=722872
+ if (typeof(trans.init) == "function")
+ trans.init(null);
+
var json = cookie.toJSON();
var wrapper1 = Xpcom.CCIN("@mozilla.org/supports-string;1", "nsISupportsString");
wrapper1.data = json;
@@ -124,6 +128,11 @@ var CookieClipboard = Obj.extend(Object,
getTransferData: function()
{
var trans = Xpcom.CCIN("@mozilla.org/widget/transferable;1", "nsITransferable");
+
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=722872
+ if (typeof(trans.init) == "function")
+ trans.init(null);
+
trans.addDataFlavor(this.cookieFlavour);
clipboard.getData(trans, Ci.nsIClipboard.kGlobalClipboard);
@@ -0,0 +1,74 @@
+/* See license.txt for terms of usage */
+
+define([
+ "firebug/firebug",
+ "firebug/lib/trace",
+ "firebug/lib/object",
+ "firebug/lib/dom",
+ "firebug/lib/locale",
+ "firebug/chrome/menu"
+],
+function(Firebug, FBTrace, Obj, Dom, Locale, Menu) {
+
+// ********************************************************************************************* //
+// Model implementation
+
+var SelectorModule = Obj.extend(Firebug.Module,
+{
+ dispatchName: "selectorModule",
+
+ initialize: function()
+ {
+ Firebug.NetMonitor.NetInfoBody.addListener(this);
+ Firebug.registerUIListener(this);
+ },
+
+ shutdown: function()
+ {
+ Firebug.NetMonitor.NetInfoBody.removeListener(this);
+ Firebug.unregisterUIListener(this);
+ },
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ // Context Menu
+
+ onContextMenu: function(items, object, target, context, panel, popup)
+ {
+ if (panel.name != "stylesheet")
+ return;
+
+ var cssRule = Dom.getAncestorByClass(target, "cssRule");
+ if (!cssRule)
+ return;
+
+ var rule = cssRule.repObject;
+ if (!rule)
+ return;
+
+ var panel = context.getPanel("selector");
+ if (!panel)
+ return;
+
+ var item = {
+ id: "fbGetMatchingElements",
+ nol10n: true,
+ label: Locale.$STR("css.selector.cmd.getMatchingElements"),
+ command: Obj.bindFixed(panel.getMatchingElements, panel, rule)
+ };
+
+ var refreshMenuItem = popup.querySelector("#fbRefresh");
+ Menu.createMenuItem(popup, item, refreshMenuItem);
+
+ return [];
+ },
+});
+
+// ********************************************************************************************* //
+// Registration
+
+Firebug.registerModule(SelectorModule);
+
+return SelectorModule;
+
+// ********************************************************************************************* //
+});
@@ -9,6 +9,7 @@ define([
"firebug/lib/domplate",
"firebug/chrome/menu",
"firebug/css/selectorEditor",
+ "firebug/css/selectorModule",
],
function(Firebug, Obj, Locale, Events, Dom, Domplate, Menu, SelectorEditor) {
with (Domplate) {
@@ -43,15 +44,11 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
initialize: function(context, doc)
{
Firebug.Panel.initialize.apply(this, arguments);
-
- Firebug.registerUIListener(this);
},
shutdown: function(context, doc)
{
Firebug.Panel.shutdown.apply(this, arguments);
-
- Firebug.unregisterUIListener(this);
},
initializeNode: function(oldPanelNode)
@@ -104,35 +101,6 @@ SelectorPanel.prototype = Obj.extend(Firebug.Panel,
return element;
},
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
- // Context Menu
-
- onContextMenu: function(items, object, target, context, panel, popup)
- {
- if (panel.name != "stylesheet")
- return;
-
- var cssRule = Dom.getAncestorByClass(target, "cssRule");
- if (!cssRule)
- return;
-
- var rule = cssRule.repObject;
- if (!rule)
- return;
-
- var item = {
- id: "fbGetMatchingElements",
- nol10n: true,
- label: Locale.$STR("css.selector.cmd.getMatchingElements"),
- command: Obj.bindFixed(this.getMatchingElements, this, rule)
- };
-
- var refreshMenuItem = popup.querySelector("#fbRefresh");
- Menu.createMenuItem(popup, item, refreshMenuItem);
-
- return [];
- },
-
getMatchingElements: function(rule)
{
this.trialSelector = rule.selectorText;
@@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>firebug@software.joehewitt.com</em:id>
- <em:version>1.11.0a3</em:version>
+ <em:version>1.11.0a4</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
@@ -32,20 +32,32 @@ function testDeleteAllWatches(callback, panelNode, targetSelector, watchExpressi
{
addWatches(watchExpressions.slice(0), function()
{
- FBTest.compare(watchExpressions.length, countWatches(panelNode), "all the watches must be added");
+ FBTest.compare(watchExpressions.length, countWatches(panelNode),
+ "all the watches must be added");
var target = panelNode.querySelector(targetSelector);
- FBTest.executeContextMenuCommand(target, "fbDeleteAllWatches", function()
+
+ var timeout, compareAndCallback, observer;
+ compareAndCallback = function()
{
- // xxxHonza: needs to be done properly.
- // The code should handle a mutation event or periodically check (for
- // limited amount of time) if the watch window is empty.
- // See: http://code.google.com/p/fbug/issues/detail?id=5958
- setTimeout(function()
- {
- FBTest.compare(0, countWatches(panelNode), "There should not be any watch");
- callback();
- }, 1000);
+ FBTest.compare(0, countWatches(panelNode), "There should not be any watch");
+ clearTimeout(timeout);
+ observer.disconnect();
+ callback();
+ };
+ // the timeout is triggered if the MutationObserver has not detected
+ // the deletion of the watch expressions
+ timeout = setTimeout(compareAndCallback, 1000);
+
+ observer = new MutationObserver(function(mutations)
+ {
+ // if there is no watch any more, we run compareAndCallback now
+ // otherwise, we wait for another mutation or for the timeout
+ if (countWatches(panelNode) === 0)
+ compareAndCallback();
});
+ observer.observe(panelNode, {childList: true});
+
+ FBTest.executeContextMenuCommand(target, "fbDeleteAllWatches");
});
}

0 comments on commit 6872691

Please sign in to comment.