view-source: pseudo protocol forces opening of new window

RESOLVED FIXED in mozilla1.8final

Status

()

--
enhancement
RESOLVED FIXED
14 years ago
11 years ago

People

(Reporter: eb3f73+buzilla+com, Assigned: jason.barnabe)

Tracking

unspecified
mozilla1.8final
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 obsolete attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; rv:1.7.3) Gecko/20040913 Firefox/0.10
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; rv:1.7.3) Gecko/20040913 Firefox/0.10

Once upon a time, I remember some Mozilla-based browsers (e.g., Galeon) being
able to use the view-source:// pseudo protocol to open page sources in new tabs.
Firefox doesn't have this ability. Even if I manually type in
view-source:http://mozilla.org/ in a new tab, it still opens a new window. For
those of us who want as few open windows as possible, this is annoying.

Reproducible: Always
Steps to Reproduce:
1. Enable tabbed browsing
2. Open a new (blank) tab
3. Type in "view-source:http://mozilla.org/ into the URL field and hit enter

Actual Results:  
A new window opened with the page source of http://mozilla.org/.

Expected Results:  
I expected the contents of the current tab to be replaced with the source view.

Comment 1

14 years ago
This is a request for enhancement and not a bug.
What you described is the intended effect.

I actually prefer the source opening up in a new window.
Severity: normal → enhancement
(Reporter)

Comment 2

14 years ago
I agree that opening a new window with the source is the correct behavior when a
user selects View -> Page Source (or types CTRL-U, etc.).

However, when typing a view-source:... URL into the location box, this behavior
is quite flawed. Try the following examples to see what I mean:

1. Start firefox (I'm using Firefox 1.0PR on Linux for this example). Wait for
the main window to come up.
2. Execute the following commands (this should open two new tabs):

    firefox -remote "openurl(http://mozilla.org/, new-tab)"
    firefox -remote "openurl(view-source:http://mozilla.org/, new-tab)"

3. Select the first of the new tabs. Click in the location box and hit return.
The Mozilla home page should reload.
4. Select the second of the new tabs. Click in the location box and hit return.
Firefox now creates a new window with contents identical to the tab that was
just selected. This is inconsistent with the rest of the interface and is a
complete surprise to the user (i.e., clearly the wrong behavior). Note: hitting
the reload button behaves properly (and reloads the source in the current tab).

Here's another example of how it is broken:

1. Create a file with the following HTML:

    <html><body>
    <a href="view-source:http://mozilla.org/">foo</a>
    </body></html>

2. Load the page in Firefox (I'm using 1.0PR on OS X for this example).
3. Click on the "foo" link. The page should be replaced by the Mozilla homepage
source.
4. Hit the back button. Right-click on the "foo" link and select one of the
"Open Link in New ..." menu items. Nothing happens.

So again, opening a new window with the source is the correct behavior when a
user selects the View -> Page Source command. However, when a view-source:...
URL is typed into the location box, or used in HTML, it should behave as any
other URL (i.e., it should replace the contents of the current tab unless
indicated to do otherwise by the user).

If, after considering the above evidence, you are not convinced this behavior is
flawed, reset this to "enhancement", and I will have to satisfied to voice my
descent here in this bug.... :-)
Severity: enhancement → normal
Summary: no way to open view-source:// links in new tabs (view source always opens new window) → view-source: pseudo protocol opens in new window at wrong times

Comment 3

14 years ago
So this is really an RFE for the following:

When view-source:// is used in the location bar the source should load in the
current tab or window.

In all other cases view-source:// should open in a new window as it does currently.
(Reporter)

Comment 4

14 years ago
Technically, the description "[i]n all other cases view-source:// should open in
a new window as it does currently" is not correct. Strictly speaking, the RFE
should be that view-source URLs are treated exactly like other URLs. Always (no
exceptions).

In addition, choosing command from a menu that results in the display of the
source of a URL (e.g., View -> Page Source, Right-Click -> View Page Source,
Right-Click -> This Frame -> View Frame Source) should be equivalent to:

    firefox -remote "openurl(view-source:${@}, new-window)"

(Where ${@} was the URL of the page/frame from which the menu command was selected.)

If this behavior is implemented as just described, then the current desired
behavior (opening new windows in response to choosing menu items) will remain
unchanged, while the inconsistencies of dealing with the raw URLs mentioned
earlier will be properly addressed.

Ultimately, it should also probably result in cleaner code since there are no
special cases for the view-source: pseudo protocol. The opening of the new
window could be tied to the specific menu commands (as it probably is with
others like the "Open Link in New Tab/Window" commands).
Summary: view-source: pseudo protocol opens in new window at wrong times → view-source: pseudo protocol forces opening of new window

Updated

14 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → enhancement
OS: MacOS X → All
Hardware: Macintosh → All

Comment 5

14 years ago
*** Bug 288008 has been marked as a duplicate of this bug. ***
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 6

14 years ago
Created attachment 180131 [details] [diff] [review]
simple enough

This removes the special case for view-source URLs which was added in bug
78619. I much prefer this behaviour (open like normal when from link or typed
in, open in new window when chosen from menu) then what bug 78619's trying to
accomplish (new window, always).

Ideally, this would also disable the view-source menu option after loading a
view-source URL, but I believe that doing such has the same problem I mention
in bug 206176 comment 3. In any case, viewing the source of a view-source URL
just gives you a highlight-less source, which isn't so bad.
Attachment #180131 - Flags: review?(mconnor)

Comment 7

14 years ago
some people want to view the source for the output from view source, it's
actually fairly useful... cases like
view-source:data:text/html,<frameset><noframes><body> (note that currently body
is not colored because htmlparser doesn't consider it a legal tag in a frameset
document - which is correct)
(Assignee)

Updated

14 years ago
Assignee: bugs → jason_barnabe
Status: ASSIGNED → NEW
Comment on attachment 180131 [details] [diff] [review]
simple enough

If for no other reason than clicking a view-source: link opens like a normal
link click, but this working is fine by me.
Attachment #180131 - Flags: review?(mconnor) → review+
(Assignee)

Updated

14 years ago
Whiteboard: [checkin needed]
Comment on attachment 180131 [details] [diff] [review]
simple enough

would check this in, but it has no a+
Attachment #180131 - Flags: superreview?(asa)
Attachment #180131 - Flags: superreview?(asa) → approval-aviary1.1a2?

Updated

14 years ago
Attachment #180131 - Flags: approval-aviary1.1a2? → approval-aviary1.1a2+
Created attachment 186438 [details] [diff] [review]
Updated for checkin
Attachment #180131 - Attachment is obsolete: true

Comment 11

14 years ago
Comment on attachment 186438 [details] [diff] [review]
Updated for checkin

mozilla/browser/base/content/browser.js 	1.438
Attachment #186438 - Attachment is obsolete: true

Updated

14 years ago
Whiteboard: [checkin needed]

Updated

14 years ago
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox1.1
>    firefox -remote "openurl(view-source:${@}, new-window)"

That wouldn't work, since the view-source window is not at all a standard Firefox browser window.
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.