browser(firefox): emit iframe lifecycle when initial navigation fails (#3389)
This commit is contained in:
parent
6054f14794
commit
da95b73b59
|
|
@ -1,2 +1,2 @@
|
||||||
1156
|
1157
|
||||||
Changed: yurys@chromium.org Mon Aug 10 20:28:44 GMTST 2020
|
Changed: dgozman@gmail.com Tue Aug 11 14:21:42 PDT 2020
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ class FrameData {
|
||||||
this._runtime = runtime;
|
this._runtime = runtime;
|
||||||
this._frame = frame;
|
this._frame = frame;
|
||||||
this._isolatedWorlds = new Map();
|
this._isolatedWorlds = new Map();
|
||||||
|
this._initialNavigationDone = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,19 +278,22 @@ class PageAgent {
|
||||||
// Sometimes we initialize later than the first about:blank page is opened.
|
// Sometimes we initialize later than the first about:blank page is opened.
|
||||||
// In this case, the page might've been loaded already, and we need to issue
|
// In this case, the page might've been loaded already, and we need to issue
|
||||||
// the `DOMContentLoaded` and `load` events.
|
// the `DOMContentLoaded` and `load` events.
|
||||||
if (mainFrame.url() === 'about:blank' && readyState === 'complete') {
|
if (mainFrame.url() === 'about:blank' && readyState === 'complete')
|
||||||
this._browserPage.emit('pageEventFired', {
|
this._emitAllEvents(this._frameTree.mainFrame());
|
||||||
frameId: this._frameTree.mainFrame().id(),
|
|
||||||
name: 'DOMContentLoaded',
|
|
||||||
});
|
|
||||||
this._browserPage.emit('pageEventFired', {
|
|
||||||
frameId: this._frameTree.mainFrame().id(),
|
|
||||||
name: 'load',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_emitAllEvents(frame) {
|
||||||
|
this._browserPage.emit('pageEventFired', {
|
||||||
|
frameId: frame.id(),
|
||||||
|
name: 'DOMContentLoaded',
|
||||||
|
});
|
||||||
|
this._browserPage.emit('pageEventFired', {
|
||||||
|
frameId: frame.id(),
|
||||||
|
name: 'load',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_onExecutionContextCreated(executionContext) {
|
_onExecutionContextCreated(executionContext) {
|
||||||
this._browserRuntime.emit('runtimeExecutionContextCreated', {
|
this._browserRuntime.emit('runtimeExecutionContextCreated', {
|
||||||
executionContextId: executionContext.id(),
|
executionContextId: executionContext.id(),
|
||||||
|
|
@ -330,16 +334,8 @@ class PageAgent {
|
||||||
const props = subject.QueryInterface(Ci.nsIPropertyBag2);
|
const props = subject.QueryInterface(Ci.nsIPropertyBag2);
|
||||||
const hasUrl = props.hasKey('url');
|
const hasUrl = props.hasKey('url');
|
||||||
const createdDocShell = props.getPropertyAsInterface('createdTabDocShell', Ci.nsIDocShell);
|
const createdDocShell = props.getPropertyAsInterface('createdTabDocShell', Ci.nsIDocShell);
|
||||||
if (!hasUrl && createdDocShell === this._docShell && this._frameTree.forcePageReady()) {
|
if (!hasUrl && createdDocShell === this._docShell && this._frameTree.forcePageReady())
|
||||||
this._browserPage.emit('pageEventFired', {
|
this._emitAllEvents(this._frameTree.mainFrame());
|
||||||
frameId: this._frameTree.mainFrame().id(),
|
|
||||||
name: 'DOMContentLoaded',
|
|
||||||
});
|
|
||||||
this._browserPage.emit('pageEventFired', {
|
|
||||||
frameId: this._frameTree.mainFrame().id(),
|
|
||||||
name: 'load',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_setInterceptFileChooserDialog({enabled}) {
|
_setInterceptFileChooserDialog({enabled}) {
|
||||||
|
|
@ -438,6 +434,10 @@ class PageAgent {
|
||||||
navigationId,
|
navigationId,
|
||||||
errorText,
|
errorText,
|
||||||
});
|
});
|
||||||
|
const frameData = this._frameData.get(frame);
|
||||||
|
if (!frameData._initialNavigationDone && frame !== this._frameTree.mainFrame())
|
||||||
|
this._emitAllEvents(frame);
|
||||||
|
frameData._initialNavigationDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSameDocumentNavigation(frame) {
|
_onSameDocumentNavigation(frame) {
|
||||||
|
|
@ -454,6 +454,7 @@ class PageAgent {
|
||||||
url: frame.url(),
|
url: frame.url(),
|
||||||
name: frame.name(),
|
name: frame.name(),
|
||||||
});
|
});
|
||||||
|
this._frameData.get(frame)._initialNavigationDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onGlobalObjectCreated({ frame }) {
|
_onGlobalObjectCreated({ frame }) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue