зеркало из https://github.com/mozilla/gecko-dev.git
Bug 849500 - navigate and will-navigate events for remoted targets carry payload that is incompatible with the non-remoted case; r=jwalker
This commit is contained in:
Родитель
6946ff0e08
Коммит
9fb1c3fe69
|
@ -288,19 +288,21 @@ TabTarget.prototype = {
|
|||
* Setup listeners for remote debugging, updating existing ones as necessary.
|
||||
*/
|
||||
_setupRemoteListeners: function TabTarget__setupRemoteListeners() {
|
||||
// Reset any conflicting event handlers that were set before makeRemote().
|
||||
if (this._webProgressListener) {
|
||||
this._webProgressListener.destroy();
|
||||
}
|
||||
|
||||
this.client.addListener("tabDetached", this.destroy);
|
||||
|
||||
this._onTabNavigated = function onRemoteTabNavigated(aType, aPacket) {
|
||||
let event = Object.create(null);
|
||||
event.url = aPacket.url;
|
||||
event.title = aPacket.title;
|
||||
// Send any stored event payload (DOMWindow or nsIRequest) for backwards
|
||||
// compatibility with non-remotable tools.
|
||||
event._navPayload = this._navPayload;
|
||||
if (aPacket.state == "start") {
|
||||
this.emit("will-navigate", aPacket);
|
||||
this.emit("will-navigate", event);
|
||||
} else {
|
||||
this.emit("navigate", aPacket);
|
||||
this.emit("navigate", event);
|
||||
}
|
||||
this._navPayload = null;
|
||||
}.bind(this);
|
||||
this.client.addListener("tabNavigated", this._onTabNavigated);
|
||||
},
|
||||
|
@ -359,6 +361,10 @@ TabTarget.prototype = {
|
|||
this.off("thread-paused", this._handleThreadState);
|
||||
|
||||
if (this._tab) {
|
||||
if (this._webProgressListener) {
|
||||
this._webProgressListener.destroy();
|
||||
}
|
||||
|
||||
this._tab.ownerDocument.defaultView.removeEventListener("unload", this);
|
||||
this._tab.removeEventListener("TabClose", this);
|
||||
this._tab.parentNode.removeEventListener("TabSelect", this);
|
||||
|
@ -368,10 +374,6 @@ TabTarget.prototype = {
|
|||
// function returns.
|
||||
// if (!this._remote) {
|
||||
if (this._tab && !this._client) {
|
||||
if (this._webProgressListener) {
|
||||
this._webProgressListener.destroy();
|
||||
}
|
||||
|
||||
targets.delete(this._tab);
|
||||
this._tab = null;
|
||||
this._client = null;
|
||||
|
@ -434,7 +436,13 @@ TabWebProgressListener.prototype = {
|
|||
|
||||
// emit event if the top frame is navigating
|
||||
if (this.target && this.target.window == progress.DOMWindow) {
|
||||
this.target.emit("will-navigate", request);
|
||||
// Emit the event if the target is not remoted or store the payload for
|
||||
// later emission otherwise.
|
||||
if (this.target._client) {
|
||||
this.target._navPayload = request;
|
||||
} else {
|
||||
this.target.emit("will-navigate", request);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -446,7 +454,13 @@ TabWebProgressListener.prototype = {
|
|||
if (this.target &&
|
||||
!(flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
let window = webProgress.DOMWindow;
|
||||
this.target.emit("navigate", window);
|
||||
// Emit the event if the target is not remoted or store the payload for
|
||||
// later emission otherwise.
|
||||
if (this.target._client) {
|
||||
this.target._navPayload = window;
|
||||
} else {
|
||||
this.target.emit("navigate", window);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -248,7 +248,8 @@ InspectorPanel.prototype = {
|
|||
/**
|
||||
* Reset the inspector on navigate away.
|
||||
*/
|
||||
onNavigatedAway: function InspectorPanel_onNavigatedAway(event, newWindow) {
|
||||
onNavigatedAway: function InspectorPanel_onNavigatedAway(event, payload) {
|
||||
let newWindow = payload._navPayload || payload;
|
||||
this.selection.setNode(null);
|
||||
this._destroyMarkup();
|
||||
this.isDirty = false;
|
||||
|
@ -503,7 +504,11 @@ InspectorPanel.prototype = {
|
|||
*/
|
||||
clearPseudoClasses: function InspectorPanel_clearPseudoClasses() {
|
||||
this.breadcrumbs.nodeHierarchy.forEach(function(crumb) {
|
||||
DOMUtils.clearPseudoClassLocks(crumb.node);
|
||||
try {
|
||||
DOMUtils.clearPseudoClassLocks(crumb.node);
|
||||
} catch(e) {
|
||||
// Ignore dead nodes after navigation.
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ Selection.prototype = {
|
|||
|
||||
isNode: function SN_isNode() {
|
||||
return (this.node &&
|
||||
!Components.utils.isDeadWrapper(this.node) &&
|
||||
this.node.ownerDocument &&
|
||||
this.node.ownerDocument.defaultView &&
|
||||
this.node instanceof this.node.ownerDocument.defaultView.Node);
|
||||
|
|
|
@ -86,7 +86,8 @@ StyleEditorPanel.prototype = {
|
|||
/**
|
||||
* Navigated to a new page.
|
||||
*/
|
||||
newPage: function StyleEditor_newPage(event, window) {
|
||||
newPage: function StyleEditor_newPage(event, payload) {
|
||||
let window = payload._navPayload || payload;
|
||||
this.reset();
|
||||
this.setPage(window);
|
||||
},
|
||||
|
@ -94,7 +95,8 @@ StyleEditorPanel.prototype = {
|
|||
/**
|
||||
* Before navigating to a new page or reloading the page.
|
||||
*/
|
||||
beforeNavigate: function StyleEditor_beforeNavigate(event, request) {
|
||||
beforeNavigate: function StyleEditor_beforeNavigate(event, payload) {
|
||||
let request = payload._navPayload || payload;
|
||||
if (this.styleEditorChrome.isDirty) {
|
||||
this.preventNavigate(request);
|
||||
}
|
||||
|
@ -206,4 +208,4 @@ XPCOMUtils.defineLazyGetter(StyleEditorPanel.prototype, "strings",
|
|||
function () {
|
||||
return Services.strings.createBundle(
|
||||
"chrome://browser/locale/devtools/styleeditor.properties");
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче