Open Bug 1938653 Opened 2 months ago Updated 1 month ago

Unable to utilize "View page source" option in context menu in sidebar.

Categories

(Firefox :: Sidebar, defect, P5)

Firefox 133
x86_64
Linux
defect

Tracking

()

People

(Reporter: zn7esutb, Unassigned)

Details

Steps to reproduce

  1. Enable the sidebar button.

  2. Invoke the sidebar:

    browser.sidebarAction.toggle()
    
  3. Invoke the context menu:

    1. let keyCodeInteger = 93 // Context Menu Key
      let buttonInteger  =  2 // Secondary Click
      
      • document.dispatchEvent(new KeyboardEvent("keydown", { keyCode: keyCodeInteger }));
        document.dispatchEvent(new KeyboardEvent("keyup",   { keyCode: keyCodeInteger }));
        
      • document.dispatchEvent(new MouseEvent("mousedown", { button: buttonInteger }));
        document.dispatchEvent(new MouseEvent("mouseup",   { button: buttonInteger }));
        
  4. Select "View page source".

Actual results

Nothing occurs.

Expected results

I should be able to view the page source. Specifically, it should be invoked in a separate tab, as occurs in standard extension modals.

Will, is there any expectation that users are able to view-source on sidebar content for e.g. an extension? For the built-in sidebars, this is browser-chrome and I don't think we've ever supported view-source for that kind of content.

Flags: needinfo?(wdurand)
Severity: -- → S4
Priority: -- → P5

From what I can see, view-source should work in the sidebar. It is supported for extension-provided content in extension popups (e.g. try in the uBlock Origin popup). That said, some extensions override the context menu and therefore view-source wouldn't be available in this case (which is fine).

Now, it looks like https://addons.mozilla.org/en-US/firefox/addon/side-view/ is a good extension to experiment with this. View-source is available but it throws an error when used:

Uncaught (in promise) TypeError: tabBrowser.addTab is not a function
    viewSourceOfDocument chrome://browser/content/browser-commands.js:499
    viewSource chrome://browser/content/browser-commands.js:526
    <anonymous> chrome://browser/content/browser-context.js:287

Oops. I believe this is what is reported to us here.

Flags: needinfo?(wdurand)

Some extensions override the context menu, and therefore view-source wouldn't be available in this case (which is fine).

Albeit off-topic, does anyone know of an issue about this? If none exists, would one be acceptable, or does Shift+SecondaryClick override it adequately? I ask because I've yet to see an extension which does so, so can't test it.

(In reply to Mr. Beedell, Roke Julian Lockhart from comment #3)

Some extensions override the context menu, and therefore view-source wouldn't be available in this case (which is fine).

Albeit off-topic, does anyone know of an issue about this? If none exists, would one be acceptable, or does Shift+SecondaryClick override it adequately? I ask because I've yet to see an extension which does so, so can't test it.

Ha, nice. TIL about shift + context click. That indeed reveals the browser context menu (I tried in Tree Style Tab).

You need to log in before you can comment on or make changes to this bug.