mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Bug 1933331 - [bidi] Update initiatorType and destination for top level document loads r=webdriver-reviewers,Sasha
The platform API currently returns values for initiatorType and destination for top level document loads, but according to the HTML spec they should be null / empty. The implementation in WebDriver BiDi NetworkRequest wrapper is updated to handle this edge case. Differential Revision: https://phabricator.services.mozilla.com/D230174
This commit is contained in:
parent
fd1ef692be
commit
937e593aec
@ -102,6 +102,10 @@ export class NetworkRequest {
|
||||
}
|
||||
|
||||
get destination() {
|
||||
if (this.#isTopLevelDocumentLoad()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return this.#channel.loadInfo?.fetchDestination;
|
||||
}
|
||||
|
||||
@ -127,6 +131,10 @@ export class NetworkRequest {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.#isTopLevelDocumentLoad()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return initiatorType;
|
||||
}
|
||||
|
||||
@ -501,4 +509,15 @@ export class NetworkRequest {
|
||||
|
||||
return navigation ? navigation.navigationId : null;
|
||||
}
|
||||
|
||||
#isTopLevelDocumentLoad() {
|
||||
if (!this.#channel.isDocument) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const browsingContext = lazy.TabManager.getBrowsingContextById(
|
||||
this.#contextId
|
||||
);
|
||||
return !browsingContext.parent;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user