webExtensions, getAllFrames returns "about:blank" for empty src iframes
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
People
(Reporter: a.minyukovich, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:86.0) Gecko/20100101 Firefox/86.0
Steps to reproduce:
calling browser.webNavigation.getAllFrames returns a list of objects representing iframes. Some iframes have an empty src, which getAllFrames shows as "about:blank", while a content script sees them as empty strings (looking at the 'src' attribute of iframe nodes).
Expected results:
Some sort of consistency, either both about:blank or both empty strings.
I realize this is a rather minor issue, but still thought to report. Use case: trying to match iframes returned by browser.webNavigation.getAllFrames with the iframes found by a parent-page content script, by matching iframe urls/src.
Comment 1•4 years ago
|
||
Hi Will,
Do you have a test case so that we can reproduce this issue, please?
Thanks in advance, Flor.
Updated•4 years ago
|
Comment 2•4 years ago
|
||
Hello,
I’m from WebExtensions QA and I’m attempting to confirm the issue. If possible, I would require the add-on you used when you encountered the issue as well as some more detailed steps to reproduce, as asked by Flor in Comment 1.
Thank you !
Comment 3•4 years ago
|
||
The webNavigation API reports the URL of the frame. Even if an empty src is used (or if src is not set at all), the URL is still implicitly about:blank. Use location.href in the frame and you'll see the same result.
If you are interested in the src attribute of the frame, insert a content script, get the frame element using frameElement global and then you can read the src attribute off it.
| Reporter | ||
Comment 4•4 years ago
|
||
You are probably right to close it. I thought the following should have been true: frameElement.src === location.href, but now realize it doesn't have to. I might file an enhancement request instead, as I needed to ensure the non-iframe main-window content script and background extension script could uniquely identify/refer to iframes, and the only info content/background scripts seemed to share was iframes' src/href (which is a problem if several iframes have the same src). Thx.
Comment 5•4 years ago
|
||
If you use the runtime.sendMessage API from a content script, then the background script with the runtime.onMessage listener can uniquely identify the frame by the tabId (via tab.id) + frameId properties of the sender parameter (the second argument of onMessage, or a port.sender property on the runtime.onConnect event).
Description
•