Closed Bug 1386707 Opened 8 years ago Closed 7 years ago

webRequest, add a public documentation about "documentUrl"

Categories

(Developer Documentation Graveyard :: Add-ons, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: 21Naown, Assigned: wbamberg)

References

Details

(Keywords: dev-doc-needed)

Add a public documentation about "documentUrl" used by webRequest. Please be as precise as possible with a concrete example, it would be very appreciable.
Component: WebExtensions: Untriaged → Add-ons
Product: Toolkit → Developer Documentation
The basis for documenting this can be found at http://searchfox.org/mozilla-central/source/dom/webidl/ChannelWrapper.webidl It should note the difference between that and the originUrl, as often/usually they are the same.
Keywords: dev-doc-needed
Flags: needinfo?(wbamberg)
Priority: -- → P1
Flags: needinfo?(wbamberg)
Assignee: nobody → wbamberg
Sorry to be so slow getting to this. I guess Comment 1 should now refer to https://searchfox.org/mozilla-central/source/dom/chrome-webidl/ChannelWrapper.webidl, but the comment there is not very understandable to me: *** (documentURL) The URL of the document loading the content for this request. This is equivalent to the LoadInfo's loadingPrincipal. (originURL) The URL of the principal that triggered this load. This is equivalent to the LoadInfo's triggeringPrincipal *** Could you give me a real-world example where these two would be different, and/or when a user might want one or the other?
Flags: needinfo?(mixedpuppy)
My descriptions are simplification of the docs in nsILoadInfo, but should illustrate the basic use. loading principal: https://searchfox.org/mozilla-central/rev/a80651653faa78fa4dfbd238d099c2aad1cec304/netwerk/base/nsILoadInfo.idl#229 A loading principal would be the document loading something, such as an image. So if a web page on example.com has an image in it, the loading principal for the image will be example.com triggering principal: https://searchfox.org/mozilla-central/rev/a80651653faa78fa4dfbd238d099c2aad1cec304/netwerk/base/nsILoadInfo.idl#269 A triggering principal may be the page that had a link to another page. User clicks on link "triggering" a load of another page.
Flags: needinfo?(mixedpuppy)
Thanks, that is helpful. Then does this sound good: * documentUrl URL of the document in which the resource will be loaded. For example, if the web page at "https://example.com" contains an image or an iframe, then the documentUrl for the image or iframe will be "https://example.com". For a top-level document, documentUrl is undefined. * originUrl URL of the resource which triggered the request. For example, if "https://example.com" contains a link, and the user clicks the link, then the originUrl for the resulting request is "https://example.com". The originUrl is often but not always the same as the documentUrl. For example, if a page contains an iframe, and the iframe contains a link that loads a new document into the iframe, then the documentUrl will be the iframe's parent document, but the originUrl will be the URL of the previous document in the iframe.
Flags: needinfo?(mixedpuppy)
That looks pretty good. Thanks!
Flags: needinfo?(mixedpuppy)
OK, thanks Shane. I've updated the webRequest.on* pages with the above.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Flags: needinfo?(wbamberg)
Also, should it not be "dev-doc-complete"?
Thanks for pointing that out, I just filed https://github.com/mdn/browser-compat-data/pull/2582. > Also, should it not be "dev-doc-complete"? No, docs bugs shouldn't set dev-doc-needed: https://groups.google.com/forum/#!topic/mozilla.dev.platform/AwM87ANMS3Y
Flags: needinfo?(wbamberg)
Compat data is updated and deployed.
You need to log in before you can comment on or make changes to this bug.