Allow to send referrer via Page.navigate
Categories
(Remote Protocol :: CDP, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: whimboo, Unassigned)
References
Details
(Whiteboard: [puppeteer-beta2-mvp] )
Currently it is not possible to set a referrer for Page.navigate(). That's happening because the referrer string gets set instead of a nsIReferrerInfo instance. Juggler does it like the following:
let referrerURI = null;
let referrerInfo = null;
if (referer) {
try {
referrerURI = NetUtil.newURI(referer);
const ReferrerInfo = Components.Constructor(
'@mozilla.org/referrer-info;1',
'nsIReferrerInfo',
'init'
);
referrerInfo = new ReferrerInfo(Ci.nsIHttpChannel.REFERRER_POLICY_UNSET, true, referrerURI);
} catch (e) {
throw new Error(`Invalid referer: "${referer}"`);
}
}
const frame = this._frameTree.frame(frameId);
const docShell = frame.docShell().QueryInterface(Ci.nsIWebNavigation);
docShell.loadURI(url, {
flags: Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
referrerInfo,
postData: null,
headers: null,
});
| Reporter | ||
Comment 1•5 years ago
|
||
Maja, can you please check if we would need that for beta2?
Puppeteer's Page.goto accepts a referer option. By default, it uses "the referer header value set by page.setExtraHTTPHeaders()".
Given that we've included Network.setExtraHTTPHeaders in beta2 (Bug 1637063), we might want to prioritize referrer via Page.navigate in order to integrate its use properly in Puppeteer.
That being said, I don't see any explicit usage of page.setExtraHTTPHeaders or referer options in WP Gutenberg. It seems the Fetch domain is rather more important there.
| Assignee | ||
Updated•4 years ago
|
Updated•3 years ago
|
| Reporter | ||
Comment 3•2 years ago
|
||
If such a feature is needed by consumers of the protocol we should put our focus on WebDriver BiDi instead, which already has a way better navigation implementation.
Description
•