Closed Bug 1752413 Opened 2 years ago Closed 2 years ago

Allow to retrieve the URI of the ongoing page load from the parent process

Categories

(Core :: DOM: Navigation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: whimboo, Assigned: smaug)

References

Details

Attachments

(1 file)

In Marionette we can have situations when we start using the WebProgress of a browsing context while it is already navigating. As such we miss the onStateChange callback for STATE_START and can't easily retrieve the URI of the current page load via the request instance. Right now the only option is to wait until another method of the listener is called.

It would be great to have the capability to immediately check the WebProgress for the current default load request and its originalURI and that directly from the parent process.

As given by Nika and Olli there is no such thing available yet. Here is what Nika mentioned on Element:

You could try adding something which just tries to read the URI from the request in BrowsingContextWebProgress I suppose? I'm not sure if it'll work all of the times you'd want it to, but it'sworth a shot

Henrik, want to try the patch?

Flags: needinfo?(hskupin)
Severity: -- → N/A
Priority: -- → P3

Thanks a lot Olli! This actually works great with the Marionette unit tests needing this feature. The only thing that I observed is that documentRequest is only set when there is an active load and otherwise null. I assume that this behavior is what we want? When not loading I can get the URL via browsingContext.currentURI.spec.

Flags: needinfo?(hskupin) → needinfo?(bugs)

That is the behavior I'd expect. It is similar-ish to nsIDocumentLoader.documentChannel behavior - once the page has been loaded, the request is gone.
Also, I did document that behavior in the .idl file ;)

Flags: needinfo?(bugs)
Assignee: nobody → bugs
Status: NEW → ASSIGNED

(In reply to Olli Pettay [:smaug] from comment #4)

Also, I did document that behavior in the .idl file ;)

Thanks! And I actually haven't had a look at the patch itself so I missed that. But sounds good.

Blocks: 1694389
Attachment #9261144 - Attachment description: WIP: Bug 1752413, add nsIWebProgress.documentRequest to let one to access the request for the document → Bug 1752413, add nsIWebProgress.documentRequest to let one to access the request for the document
Attachment #9261144 - Attachment description: Bug 1752413, add nsIWebProgress.documentRequest to let one to access the request for the document → Bug 1752413, add nsIWebProgress.documentRequest to let one to access the request for the document, r=nika
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/974475ee83ec
add nsIWebProgress.documentRequest to let one to access the request for the document, r=nika
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Blocks: 1753288
No longer blocks: 1694389
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: