Skip to content

Commit

Permalink
Merge with the master (issue 1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
janodvarko committed Mar 31, 2014
2 parents 42f02db + 6c8ebd2 commit 2b7ba7c
Show file tree
Hide file tree
Showing 681 changed files with 19,905 additions and 13,217 deletions.
1 change: 1 addition & 0 deletions extension/chrome.bz.tpl.manifest
Expand Up @@ -58,6 +58,7 @@ locale firebug nb-NO locale/nb-NO/
locale firebug nl locale/nl/
locale firebug oc locale/oc/
locale firebug pl locale/pl/
locale firebug pt locale/pt/
locale firebug pt-BR locale/pt-BR/
locale firebug pt-PT locale/pt-PT/
locale firebug ro-RO locale/ro-RO/
Expand Down
4 changes: 1 addition & 3 deletions extension/content/firebug/accessible/a11y.js
Expand Up @@ -1282,7 +1282,7 @@ Firebug.A11yModel = Obj.extend(Module,
break;

case Node.ATTRIBUTE_NODE:
elem = node.ownerElement;
elem = match.ownerElement;
matchFeedback += Locale.$STRF("a11y.updates.match found in attribute",
[match.match[0], node.name, node.value, elem.nodeName,
Xpath.getElementTreeXPath(elem)]);
Expand Down Expand Up @@ -1665,7 +1665,6 @@ Firebug.A11yModel = Obj.extend(Module,
}
//these context menu options are likely to destroy current focus
panelA11y.reFocusId = Xpath.getElementXPath(event.target);
document.popupNode = node;
Firebug.chrome.$("fbContextMenu").openPopup(node, "overlap", 0,0,true);
Events.cancelEvent(event); //no need for default handlers anymore
}
Expand Down Expand Up @@ -2327,7 +2326,6 @@ Firebug.A11yModel = Obj.extend(Module,
var y = event.pageY;
if (y >= event.target.clientHeight)
y = node.offsetTop;
Firebug.chrome.window.document.popupNode = node;
Firebug.chrome.$("fbContextMenu").openPopup(node.ownerDocument.body, "overlap", x, y,
true);
Events.cancelEvent(event);
Expand Down
4 changes: 2 additions & 2 deletions extension/content/firebug/branch.properties
@@ -1,6 +1,6 @@
# DO NOT MERGE INTO TRUNK
RELEASE=.0a9
VERSION=1.13.jsd2
RELEASE=a1
VERSION=2.0
TRUNK=
# To allow build.xml to drop the xpi directly into the svn working copy for getfirebug.com
# the root of the fbug svn tree must be be at the same level as the root of getfirebug.com
Expand Down
5 changes: 5 additions & 0 deletions extension/content/firebug/bti/inProcess/compilationunit.js
Expand Up @@ -215,6 +215,11 @@ CompilationUnit.prototype._removeBreakpoint = function(breakpoint)
}
};

CompilationUnit.prototype.toString = function()
{
return "[compilation-unit] " + this.url;
};

// ********************************************************************************************* //
// CommonJS

Expand Down
70 changes: 30 additions & 40 deletions extension/content/firebug/chrome/chrome.js
Expand Up @@ -340,13 +340,15 @@ var FirebugChrome =

updateOption: function(name, value)
{
// xxxHonza: I think we should distribute updateOption also to all panels
// in all contexts.
if (panelBar1 && panelBar1.selectedPanel)
panelBar1.selectedPanel.updateOption(name, value);

if (panelBar2 && panelBar2.selectedPanel)
panelBar2.selectedPanel.updateOption(name, value);
// Distributed 'updateOption' to all panels (main + side) in all
// existing contexts.
Firebug.TabWatcher.iterateContexts(function(context)
{
context.eachPanelInContext(function(panel)
{
panel.updateOption(name, value);
});
});

if (name == "textSize")
this.applyTextSize(value);
Expand Down Expand Up @@ -1376,7 +1378,7 @@ var FirebugChrome =
if (popup.id != "fbContextMenu")
return;

var target = win.document.popupNode;
var target = popup.triggerNode;
var panel = target ? Firebug.getElementPanel(target) : null;

// The event must be on our chrome not inside the panel.
Expand Down Expand Up @@ -1430,23 +1432,26 @@ var FirebugChrome =
// 1. Add the custom menu items from the realRep
if (realObject && realRep)
{
var items = realRep.getContextMenuItems(realObject, target, Firebug.currentContext);
var items = realRep.getContextMenuItems(realObject, target, Firebug.currentContext,
lastMouseDownPosition.clientX, lastMouseDownPosition.clientY);
if (items)
Menu.createMenuItems(popup, items);
}

// 2. Add the custom menu items from the original rep
if (object && rep && rep != realRep)
{
var items = rep.getContextMenuItems(object, target, Firebug.currentContext);
var items = rep.getContextMenuItems(object, target, Firebug.currentContext,
lastMouseDownPosition.clientX, lastMouseDownPosition.clientY);
if (items)
Menu.createMenuItems(popup, items);
}

// 3. Add the custom menu items from the panel
if (panel)
{
var items = panel.getContextMenuItems(realObject, target);
var items = panel.getContextMenuItems(realObject, target, null,
lastMouseDownPosition.clientX, lastMouseDownPosition.clientY);
if (items)
Menu.createMenuItems(popup, items);
}
Expand Down Expand Up @@ -1605,29 +1610,6 @@ var FirebugChrome =
}
},

breakOnNext: function(context, event)
{
// avoid bubbling from associated options
if (event.target.id != "cmd_firebug_toggleBreakOn")
return;

if (!context)
{
if (FBTrace.DBG_BP)
FBTrace.sysout("Firebug chrome: breakOnNext with no context??");
return;
}

var panel = panelBar1.selectedPanel;

if (FBTrace.DBG_BP)
FBTrace.sysout("Firebug chrome: breakOnNext for panel " +
(panel ? panel.name : "NO panel"), panel);

if (panel && panel.breakable)
Firebug.Breakpoint.toggleBreakOnNext(panel);
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

visitWebsite: function(which, arg)
Expand Down Expand Up @@ -1991,13 +1973,21 @@ function onPanelClick(event)
}
}

var lastMouseDownPosition = {x: -1000, y: -1000};
var lastMouseDownPosition = {
screenX: -1000,
screenY: -1000,
clientX: -1000,
clientY: -1000,
};

function onPanelMouseDown(event)
{
if (Events.isLeftClick(event))
if (Events.isLeftClick(event) || Events.isRightClick(event))
{
lastMouseDownPosition.x = event.screenX;
lastMouseDownPosition.y = event.screenY;
lastMouseDownPosition.screenX = event.screenX;
lastMouseDownPosition.screenY = event.screenY;
lastMouseDownPosition.clientX = event.clientX;
lastMouseDownPosition.clientY = event.clientY;
}
else if (Events.isMiddleClick(event, true) && Events.isControlAlt(event))
{
Expand Down Expand Up @@ -2041,8 +2031,8 @@ function onPanelMouseUp(event)

if (selectedRange.collapsed)
{
var distance = Math.abs(event.screenX - lastMouseDownPosition.x) +
Math.abs(event.screenY - lastMouseDownPosition.y);
var distance = Math.abs(event.screenX - lastMouseDownPosition.screenX) +
Math.abs(event.screenY - lastMouseDownPosition.screenY);

// If mouse has moved far enough, set selection at that point
if (distance > 3 || Css.hasClass(event.target, "inlineExpander"))
Expand Down
4 changes: 3 additions & 1 deletion extension/content/firebug/chrome/eventSource.js
Expand Up @@ -61,7 +61,9 @@ EventSource.prototype =
dispatch: function(eventName, args)
{
if (this.fbListeners && this.fbListeners.length > 0)
Events.dispatch(this.fbListeners, eventName, args);
return Events.dispatch(this.fbListeners, eventName, args);

return [];
},

dispatch2: function(eventName, args)
Expand Down
71 changes: 54 additions & 17 deletions extension/content/firebug/chrome/panel.js
Expand Up @@ -29,9 +29,22 @@ var TraceError = FBTrace.toError();
// Implementation

/**
* @panel Base class for all panels. Every derived panel must define a constructor and
* @panel Base object for all Firebug panels. Every derived panel must define a constructor and
* register with <code>Firebug.registerPanel</code> method. An instance of the panel
* object is created by the framework for each browser tab where Firebug is activated.
*
* An example of a new panel:
* <code>
* function MyPanel() {}
* MyPanel.prototype = Obj.extend(Firebug.Panel,
* {
* initialize: function(context, doc)
* {
* Firebug.Panel.initialize.apply(this, arguments);
* Trace.sysout("My Panel initialized!");
* }
* });
* </code>
*/
var Panel = Obj.extend(new EventSource(),
/** @lends Panel */
Expand Down Expand Up @@ -245,6 +258,9 @@ var Panel = Obj.extend(new EventSource(),
return false;
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Location

navigate: function(object)
{
// Get default location object if none is specified.
Expand Down Expand Up @@ -291,6 +307,18 @@ var Panel = Obj.extend(new EventSource(),
{
},

/**
* Normalize location object to make sure we always deal with an object presented
* in the location list.
*/
normalizeLocation: function(object)
{
return object;
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Selection

select: function(object, forceUpdate)
{
if (!object)
Expand Down Expand Up @@ -331,6 +359,8 @@ var Panel = Obj.extend(new EventSource(),
{
},

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

/**
* Redisplay the panel based on the current location and selection
*/
Expand Down Expand Up @@ -534,7 +564,8 @@ var Panel = Obj.extend(new EventSource(),
* for the current search keyword.
* @param {Boolean} reverse Indicates whether passing through the documents
* should be done in reverse order
* @param {Object} The current document used in the (asynchronous) loop.
* @param {Object} doc The current document used in the (asynchronous) loop.
* @param {Object} deferred Internally used to deal with asynchronous loops.
*
* @return {Object} The method can return
* 1) A document object that has been found
Expand All @@ -543,6 +574,18 @@ var Panel = Obj.extend(new EventSource(),
*/
navigateToNextDocument: function(match, reverse, doc, deferred)
{
if (!doc)
{
TraceError.sysout("panel.navigateToNextDocument; NULL location!");
return;
}

// Normalize location object to make sure we are dealing only with
// objects coming from the location list. This allows us to compare
// theme and find the right next location (document).
var location = this.normalizeLocation(this.location);
doc = this.normalizeLocation(doc);

// The result value of the following promise will be resolved to
// true if a document matching the search keyword has been found.
// It'll be resolved to false if all documents have been checked
Expand All @@ -560,7 +603,7 @@ var Panel = Obj.extend(new EventSource(),
// The result value must be a promise in such case.
var result = match(doc);

Trace.sysout("panel.navigateToNextDocument; " + doc.href + ", match: " + result);
Trace.sysout("panel.navigateToNextDocument; " + doc + ", match: " + result);

// It isn't nice to use isPromise in general, but we don't want to force
// every panel to use promises, so {@link Promise} as the return value is not
Expand All @@ -571,7 +614,7 @@ var Panel = Obj.extend(new EventSource(),
result.then((found) =>
{
Trace.sysout("panel.navigateToNextDocument; async match done: " +
found + ", for: " + doc.href, result);
found + ", for: " + doc, result);

if (found)
{
Expand All @@ -585,22 +628,16 @@ var Panel = Obj.extend(new EventSource(),
if (Trace.active)
{
Trace.sysout("panel.navigateToNextDocument; next async cycle: " +
(doc.href !== this.location.href ? "yes" : "no") + ", [doc: " +
Url.getFileName(doc.href) + "], [location: " +
Url.getFileName(this.location.href) + "]");
(doc !== location ? "yes" : "no") + ", [doc: " +
doc + "], [location: " + location + "]");
}

// There was no search match in the current document, let's move
// to the next one. If the next one is the one we started with
// we already iterated all documents, so resolve the final
// promise to false.
// xxxHonza: ideally we should compare (doc !== this.location)
// but the Script panel is also using SourceLink instances as the
// location and so, it wouldn't work.
// It should be possible to normalize panel's location through
// 'normalizeLocation' API implemented by derived panels.
// (jut like it's done for the selection, see: normalizeSelection)
if (doc.href !== this.location.href)

if (doc !== location)
this.navigateToNextDocument(match, reverse, doc, deferred);
else
deferred.resolve(false);
Expand All @@ -620,10 +657,10 @@ var Panel = Obj.extend(new EventSource(),
return doc;
}

Trace.sysout("panel.navigateToNextDocument; next cycle? " + doc.href +
" !== " + this.location.href);
Trace.sysout("panel.navigateToNextDocument; next cycle? " + doc +
(doc !== location ? " !== " : " == ") + location);

} while (doc.href !== this.location.href);
} while (doc !== location);

// There is no document that would match the search keyword, so resolve
// the final promise to false.
Expand Down

0 comments on commit 2b7ba7c

Please sign in to comment.