mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
d9bf59efa7
commit
24790d3940
@ -201,7 +201,7 @@ let DebuggerController = {
|
||||
* Packet received from the server.
|
||||
*/
|
||||
_onTabNavigated: function DC__onTabNavigated(aType, aPacket) {
|
||||
if (aPacket.state == "start") {
|
||||
if (aType == "will-navigate") {
|
||||
DebuggerView._handleTabNavigation();
|
||||
|
||||
// Discard all the old sources.
|
||||
|
@ -40,14 +40,7 @@ function testInitialLoad() {
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
@ -66,14 +59,7 @@ function testLocationChange()
|
||||
|
||||
function testBack()
|
||||
{
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired after going back.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
@ -93,14 +79,7 @@ function testBack()
|
||||
|
||||
function testForward()
|
||||
{
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired after going forward.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -73,13 +73,7 @@ function testSimpleCall() {
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -73,13 +73,7 @@ function testSimpleCall() {
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -50,13 +50,7 @@ function testSimpleCall() {
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -109,14 +109,7 @@ function doSearch() {
|
||||
|
||||
function testLocationChange()
|
||||
{
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
return;
|
||||
}
|
||||
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired after location change.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -125,15 +125,8 @@ function fetchSources(callback) {
|
||||
}
|
||||
|
||||
function performReload(callback) {
|
||||
gDebugger.DebuggerController.client.addListener("tabNavigated", function onTabNavigated(aEvent, aPacket) {
|
||||
dump("tabNavigated state " + aPacket.state + "\n");
|
||||
if (aPacket.state == "start") {
|
||||
testStateBeforeReload();
|
||||
return;
|
||||
}
|
||||
|
||||
gDebugger.DebuggerController.client.removeListener("tabNavigated", onTabNavigated);
|
||||
|
||||
gDebugger.DebuggerController._target.once("will-navigate", testStateBeforeReload);
|
||||
gDebugger.DebuggerController._target.once("navigate", function onTabNavigated(aEvent, aPacket) {
|
||||
ok(true, "tabNavigated event was fired.");
|
||||
info("Still attached to the tab.");
|
||||
|
||||
|
@ -306,19 +306,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);
|
||||
},
|
||||
@ -377,6 +379,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);
|
||||
@ -385,10 +391,6 @@ TabTarget.prototype = {
|
||||
// If this target was not remoted, the promise will be resolved before the
|
||||
// function returns.
|
||||
if (this._tab && !this._client) {
|
||||
if (this._webProgressListener) {
|
||||
this._webProgressListener.destroy();
|
||||
}
|
||||
|
||||
targets.delete(this._tab);
|
||||
this._tab = null;
|
||||
this._client = null;
|
||||
@ -454,7 +456,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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -466,7 +474,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");
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user