I don't know of any way to actually distinguish page-worker
requests from "regular" ones.
Current, page workers are implemented like this:
- The SDK essentially creates an
<iframe>
in the hiddenWindow
(technically, in sdk/addon/window
, which creates a hidden window in the hiddenWindow
). The hiddenWindow
in mozilla applications is more or less an always-present top-level XUL or HTML window that is simply hidden.
- The worker page is loaded into that
iframe
.
- The page-worker will then operate on the DOM on that
iframe
.
It is possible to identify requests originating from the hidden window and the document within the hidden window.
But identifying if the request or associated document belongs to a page-worker
, let alone which page-worker
instance, doesn't seem possible, judging from the code. The SDK itself could map the document associated with a request back to a page-worker
, as it keeps some WeakMap
s around to do so, but that is internal stuff you cannot access.
You only can say that a request is not coming from a page-worker when it is not coming from the hiddenWindow
.
Also, keep in mind that there are tons of requests originating neither from a tab
nor page-worker
: Other (XUL) windows, add-ons, js modules and components, etc...
If it a page-worker
created by your add-on that you're interested in: The contentURL
property should reflect the final URI once the page is loaded.