Closed Bug 1398453 Opened 7 years ago Closed 6 years ago

Context menu info srcUrl is blank in youtube videos

Categories

(WebExtensions :: Frontend, defect, P3)

56 Branch
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: hanu6, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Whiteboard: [contextMenus])

Attachments

(1 file)

634 bytes, application/x-zip-compressed
Details
Attached file bug.zip
User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170824053622

Steps to reproduce:

happens in 55 and 56 at least.
load bug.zip
1. Click the context menu item on a youtube video
3. console.log the info given
3. Check the browser console



Actual results:

srcUrl: ""


Expected results:

srcUrl should be something instead of nothing
Priority: -- → P3
Whiteboard: [contextMenus]
Product: Toolkit → WebExtensions
YouTube assigns a blob:-URL to the video, and then revokes the URL (which makes the URL unusable).
Firefox's context menu also treats the URL as non-existent: The "Copy Video Location" menu item is disabled too.

I am inclined to close this bug, but before doing so I'd like to understand your use case, to see if there may be alternatives.
Why do you want a non-blank URL on YouTube?
Assignee: nobody → rob
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(hanu6)
Using the context menu item to inject a script means that the srcUrl is the only thing to distinguish which video was targeted.

to summarize:
- right click any video on page
- use the context menu item
- addon background script injects a content script and sends the srcUrl to it
- content script matches the video by comparing srcUrls and does its thing

In Youtube I can get around the src being blank because in youtube there is only one video/page. Some other website might not be so lucky. So even revoked URL's would be better than nothing in this case. Alternatively, reworking context menu info to give off more stats about used html element would be nice.
Flags: needinfo?(hanu6)
(In reply to hanu6 from comment #2)
> Using the context menu item to inject a script means that the srcUrl is the
> only thing to distinguish which video was targeted.
> 
> to summarize:
> - right click any video on page
> - use the context menu item
> - addon background script injects a content script and sends the srcUrl to it
> - content script matches the video by comparing srcUrls and does its thing
> 
> In Youtube I can get around the src being blank because in youtube there is
> only one video/page. Some other website might not be so lucky. So even
> revoked URL's would be better than nothing in this case. Alternatively,
> reworking context menu info to give off more stats about used html element
> would be nice.

And if there are multiple video elements with the same src, then you would might return the incorrect information.
Or if YouTube updates the src to a different blob:-URL, then the element can also be lost.

Thanks for this additional information: It is clear that you don't really care about the value of "src", but you actually want a way to identify the clicked element. Therefore I close this bug, and refer to bug 1325814 where a reliable way to identify the clicked element is being developed.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: