Open Bug 1190179 Opened 4 years ago Updated 4 years ago

Port |Bug 1067325 - Add an option to view html source in a tab| to SeaMonkey

Categories

(SeaMonkey :: General, defect)

defect
Not set

Tracking

(firefox42 affected)

ASSIGNED
Tracking Status
firefox42 --- affected

People

(Reporter: iann_bugzilla, Assigned: iann_bugzilla)

References

Details

Attachments

(1 file)

From Bug 1067325 comment 0
It would be nice to be able to define that view-source is opened in a tab and not in a separate window. That allows reducing clutter in your window manager and that also allows keeping the source code of a page next to the tab of the actual page it refers to. If you open the source for 3 pages to compare the generated html (comparing a page on trunk/stage/production servers for example), you want the source to be visually close to the tab it represents.

Currently we overlay the view source window to disable certain things and fix-up others. This WIP patch does not address those issues, some feedback on the best way forward would be useful. Another potential addition would be to port Firefox's RecentWindow.jsm code, but that might be overkill.
Attachment #8642173 - Flags: feedback?(philip.chee)
Attachment #8642173 - Flags: feedback?(neil)
(In reply to Ian Neal)
> Currently we overlay the view source window to disable certain things and
> fix-up others.
We actually overlay it to:
* Provide a menu bar
* Allow the viewed page to be edited
Obviously a browser window would have a menubar, and it would allow us to edit regular view source pages, but we would need to prevent saving or editing viewing of partial source, and we'd probably also want want to prevent viewing source of source.
Comment on attachment 8642173 [details] [diff] [review]
Port changes (WIP)

>+pref("view_source.tab", true);
false, unless you're willing to add the rest of the view source window's functionality, such as showing the current line in the status bar, and the go to line menuitem.

>+function ViewSourceTabOrWindow(aArgs) {
Nit: ViewSourceInTabOrWindow. Also, this needs to live somewhere where nsContextMenu can definitely access it.

>+    let tab = tabBrowser.loadOneTab(viewSourceURL,
>+                                    {relatedToCurrent: true,
>+                                     inBackground: false});
Don't load anything when adding the tab, we don't want to hit the network. (viewSourceInBrowser sends async messages so we don't know whether it will prevent the load or not.)

>+      let tabBrowser = gBrowser;
>+      // In some cases (e.g. sidebars), gBrowser is defined but null because no
>+      // #content element exists so need to find the most recent browser window.
>+      // In the case of popups, we need to find a non-popup browser window.
>+      if (!tabBrowser || !window.toolbar.visible)
>+        tabBrowser = getTopWin().gBrowser;
Need to look into whether this actually does anything useful in SeaMonkey.
Attachment #8642173 - Flags: feedback?(neil)
Also need to port other changes that have happened to viewSource, e.g. bug 1169723
Depends on: 1165599
Depends on: 1201535
Comment on attachment 8642173 [details] [diff] [review]
Port changes (WIP)

New patch needed.
Attachment #8642173 - Flags: feedback?(philip.chee)
You need to log in before you can comment on or make changes to this bug.