Open Bug 1632649 Opened 5 years ago Updated 4 years ago

Page.navigate should work with same-document anchor navigation

Categories

(Remote Protocol :: CDP, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: impossibus, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [puppeteer-beta2-mvp])

Examples

New document:

Page.navigate({"url":"https://wiki.mozilla.org/Remote#Staff"})
          Network.requestWillBeSent({"documentURL":"https://wiki.mozilla.org/Remote","frameId":"8F92BC4D0BEB9C9E8472773923AFFA26","hasUserGesture":false,"initiator":{"type":"other"},"loaderId":"250384C94309484762539F5C72A34BE9","request":{"headers":{"Sec-Fetch-Dest":"document","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/80.0.3987.0 Safari/537.36"},"initialPriority":"VeryHigh","method":"GET","mixedContentType":"none","referrerPolicy":"no-referrer-when-downgrade","url":"https://wiki.mozilla.org/Remote","urlFragment":"#Staff"},"requestId":"250384C94309484762539F5C72A34BE9","timestamp":145469.099984,"type":"Document","wallTime":1587675617.105546})
 Network.requestWillBeSentExtraInfo({"blockedCookies":[],"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-GB","Connection":"keep-alive","Host":"wiki.mozilla.org","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/80.0.3987.0 Safari/537.36"},"requestId":"250384C94309484762539F5C72A34BE9"})
  Network.responseReceivedExtraInfo({"blockedCookies":[],"headers":{"Accept-Ranges":"bytes","Age":"13844","Cache-Control":"s-maxage=18000, must-revalidate, max-age=0, max-age=1800","Connection":"keep-alive","Content-Encoding":"gzip","Content-Length":"9868","Content-Type":"text/html; charset=UTF-8","Content-language":"en","Date":"Thu, 23 Apr 2020 17:09:33 GMT","Expires":"Thu, 23 Apr 2020 17:39:33 GMT","Last-Modified":"Thu, 23 Apr 2020 12:09:33 GMT","Server":"Apache/2.4.18 (Ubuntu)","Strict-Transport-Security":"max-age=31536000","Vary":"Accept-Encoding,Cookie","Via":"1.1 varnish-v4","X-Cache":"HIT","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","X-Nubis-Build":"amazon-ebs-ubuntu","X-Nubis-Project":"wiki","X-Nubis-Version":"v2.3.0_eceab526c77bbc33cc3a938b06c7313cd5a39c60","X-UA-Compatible":"IE=Edge","X-Varnish":"14942973 10257569","X-XSS-Protection":"1; mode=block"},"headersText":"HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nAge: 13844\r\nCache-Control: s-maxage=18000, must-revalidate, max-age=0, max-age=1800\r\nContent-Encoding: gzip\r\nContent-language: en\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Thu, 23 Apr 2020 17:09:33 GMT\r\nExpires: Thu, 23 Apr 2020 17:39:33 GMT\r\nLast-Modified: Thu, 23 Apr 2020 12:09:33 GMT\r\nServer: Apache/2.4.18 (Ubuntu)\r\nStrict-Transport-Security: max-age=31536000\r\nVary: Accept-Encoding,Cookie\r\nVia: 1.1 varnish-v4\r\nX-Cache: HIT\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: DENY\r\nX-Nubis-Build: amazon-ebs-ubuntu\r\nX-Nubis-Project: wiki\r\nX-Nubis-Version: v2.3.0_eceab526c77bbc33cc3a938b06c7313cd5a39c60\r\nX-UA-Compatible: IE=Edge\r\nX-Varnish: 14942973 10257569\r\nX-XSS-Protection: 1; mode=block\r\nContent-Length: 9868\r\nConnection: keep-alive\r\n\r\n","requestId":"250384C94309484762539F5C72A34BE9"})
           Network.responseReceived({"frameId":"8F92BC4D0BEB9C9E8472773923AFFA26","loaderId":"250384C94309484762539F5C72A34BE9","requestId":"250384C94309484762539F5C72A34BE9","response":{"connectionId":12,"connectionReused":false,"encodedDataLength":791,"fromDiskCache":false,"fromPrefetchCache":false,"fromServiceWorker":false,"headers":{"Accept-Ranges":"bytes","Age":"13844","Cache-Control":"s-maxage=18000, must-revalidate, max-age=0, max-age=1800","Connection":"keep-alive","Content-Encoding":"gzip","Content-Length":"9868","Content-Type":"text/html; charset=UTF-8","Content-language":"en","Date":"Thu, 23 Apr 2020 17:09:33 GMT","Expires":"Thu, 23 Apr 2020 17:39:33 GMT","Last-Modified":"Thu, 23 Apr 2020 12:09:33 GMT","Server":"Apache/2.4.18 (Ubuntu)","Strict-Transport-Security":"max-age=31536000","Vary":"Accept-Encoding,Cookie","Via":"1.1 varnish-v4","X-Cache":"HIT","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY","X-Nubis-Build":"amazon-ebs-ubuntu","X-Nubis-Project":"wiki","X-Nubis-Version":"v2.3.0_eceab526c77bbc33cc3a938b06c7313cd5a39c60","X-UA-Compatible":"IE=Edge","X-Varnish":"14942973 10257569","X-XSS-Protection":"1; mode=block"},"headersText":"HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nAge: 13844\r\nCache-Control: s-maxage=18000, must-revalidate, max-age=0, max-age=1800\r\nContent-Encoding: gzip\r\nContent-language: en\r\nContent-Type: text/html; charset=UTF-8\r\nDate: Thu, 23 Apr 2020 17:09:33 GMT\r\nExpires: Thu, 23 Apr 2020 17:39:33 GMT\r\nLast-Modified: Thu, 23 Apr 2020 12:09:33 GMT\r\nServer: Apache/2.4.18 (Ubuntu)\r\nStrict-Transport-Security: max-age=31536000\r\nVary: Accept-Encoding,Cookie\r\nVia: 1.1 varnish-v4\r\nX-Cache: HIT\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: DENY\r\nX-Nubis-Build: amazon-ebs-ubuntu\r\nX-Nubis-Project: wiki\r\nX-Nubis-Version: v2.3.0_eceab526c77bbc33cc3a938b06c7313cd5a39c60\r\nX-UA-Compatible: IE=Edge\r\nX-Varnish: 14942973 10257569\r\nX-XSS-Protection: 1; mode=block\r\nContent-Length: 9868\r\nConnection: keep-alive\r\n\r\n","mimeType":"text/html","protocol":"http/1.1","remoteIPAddress":"52.88.156.223","remotePort":443,"requestHeaders":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Accept-Encoding":"gzip, deflate, br","Accept-Language":"en-GB","Connection":"keep-alive","Host":"wiki.mozilla.org","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/80.0.3987.0 Safari/537.36"},"requestHeadersText":"GET /Remote HTTP/1.1\r\nHost: wiki.mozilla.org\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/80.0.3987.0 Safari/537.36\r\nSec-Fetch-Dest: document\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: none\r\nSec-Fetch-Mode: navigate\r\nSec-Fetch-User: ?1\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-GB\r\n","securityDetails":{"certificateId":0,"certificateTransparencyCompliance":"unknown","cipher":"AES_128_GCM","issuer":"DigiCert SHA2 Secure Server CA","keyExchange":"ECDHE_RSA","keyExchangeGroup":"P-256","protocol":"TLS 1.2","sanList":["wiki.mozilla.org","m.wiki.mozilla.org"],"signedCertificateTimestampList":[],"subjectName":"wiki.mozilla.org","validFrom":1573516800,"validTo":1605528000},"securityState":"secure","status":200,"statusText":"OK","timing":{"connectEnd":301.848,"connectStart":64.51,"dnsEnd":64.51,"dnsStart":11.417,"proxyEnd":-1,"proxyStart":-1,"pushEnd":0,"pushStart":0,"receiveHeadersEnd":383.096,"requestTime":145469.101217,"sendEnd":302.079,"sendStart":301.954,"sslEnd":301.767,"sslStart":139.593,"workerReady":-1,"workerStart":-1},"url":"https://wiki.mozilla.org/Remote"},"timestamp":145469.486134,"type":"Document"})
                      Page.navigate({"url":"https://wiki.mozilla.org/Remote#Staff"}) = {"frameId":"8F92BC4D0BEB9C9E8472773923AFFA26","loaderId":"250384C94309484762539F5C72A34BE9"}

Same document

               Page.navigate({"url":"https://wiki.mozilla.org/Remote#Staff"})
               Page.navigate({"url":"https://wiki.mozilla.org/Remote#Staff"}) = {"frameId":"8F92BC4D0BEB9C9E8472773923AFFA26"}
Page.navigatedWithinDocument({"frameId":"8F92BC4D0BEB9C9E8472773923AFFA26","url":"https://wiki.mozilla.org/Remote#Staff"})

Maja, what's broken here? Note that there is also bug 1549520 for the event.

Flags: needinfo?(mjzffr)
Flags: needinfo?(mjzffr)
Summary: Page.navigate should work with anchor navigation → Page.navigate should work with same-document anchor navigation

The navigate implementation only considers network events. We don't get those on same-document navigation.

Priority: -- → P2
Whiteboard: [puppeteer-beta-reserve]

Note that we would have to listen for the hashchange event to properly return from the navigation. See https://github.com/puppeteer/puppeteer/issues/5806 for a possible use case. A couple of modern frameworks like react are affected here.

Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta2-mvp]
Component: CDP: Page → CDP
You need to log in before you can comment on or make changes to this bug.