Closed Bug 882977 Opened 11 years ago Closed 11 years ago

Identity state of IDENTITY_MODE_UNKNOWN is set for about:home when a new window is created

Categories

(Firefox :: Security, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 25

People

(Reporter: jaws, Assigned: jaws)

References

Details

(Whiteboard: fixed by bug 893424)

Attachments

(1 file, 3 obsolete files)

about:home should have an identity state of IDENTITY_MODE_CHROMEUI, but instead it ends up with an identity state of IDENTITY_MODE_UNKNOWN when a new window is created.

Setting a breakpoint within onSecurityChange shows that the location is set as about:blank, which leads the location.protocol to become "http:".

Gavin, do you know how we can change gBrowser.contentWindow.location to return about:home when a new window is created instead of about:blank?
Flags: needinfo?(gavin.sharp)
(In reply to Jared Wein [:jaws] from comment #0)
> about:home should have an identity state of IDENTITY_MODE_CHROMEUI, but
> instead it ends up with an identity state of IDENTITY_MODE_UNKNOWN when a
> new window is created.

What do you mean by "when a new window is created"? Are you saying there's a behavior difference between loading about:home in an existing window, and having it load in a new window (with e.g. Shift+Go button)? STR would help.

From what you describe, it seems likely that we'd need to change when onSecurityChange is firing (frequency or timing).
Flags: needinfo?(gavin.sharp)
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #1)
> (In reply to Jared Wein [:jaws] from comment #0)
> > about:home should have an identity state of IDENTITY_MODE_CHROMEUI, but
> > instead it ends up with an identity state of IDENTITY_MODE_UNKNOWN when a
> > new window is created.
> 
> What do you mean by "when a new window is created"? Are you saying there's a
> behavior difference between loading about:home in an existing window, and
> having it load in a new window (with e.g. Shift+Go button)? STR would help.
> 
> From what you describe, it seems likely that we'd need to change when
> onSecurityChange is firing (frequency or timing).

Sorry, here's clearer STR:

1) In a pre-existing window, visit about:home
2) Use DOMi to check the className on #identity-box
3) It should be '.chromeUI'
4) Make sure that your home page is set to about:home
5) Press Ctrl+N (or Cmd+N if on a Mac) to open a new window
6) Use DOMi to check the className on #identity-box

Expected:
7a) It should be '.chromeUI'

Actual:
7b) It is '.unknownIdentity'
(In reply to Jared Wein [:jaws] from comment #2)
> (In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment
> #1)
> > (In reply to Jared Wein [:jaws] from comment #0)
> > > about:home should have an identity state of IDENTITY_MODE_CHROMEUI, but
> > > instead it ends up with an identity state of IDENTITY_MODE_UNKNOWN when a
> > > new window is created.
> > 
> > What do you mean by "when a new window is created"? Are you saying there's a
> > behavior difference between loading about:home in an existing window, and
> > having it load in a new window (with e.g. Shift+Go button)? STR would help.
> > 
> > From what you describe, it seems likely that we'd need to change when
> > onSecurityChange is firing (frequency or timing).
> 
> Sorry, here's clearer STR:
> 
> 1) In a pre-existing window, visit about:home
> 2) Use DOMi to check the className on #identity-box
> 3) It should be '.chromeUI'
> 4) Make sure that your home page is set to about:home
> 5) Press Ctrl+N (or Cmd+N if on a Mac) to open a new window
> 6) Use DOMi to check the className on #identity-box
> 
> Expected:
> 7a) It should be '.chromeUI'
> 
> Actual:
> 7b) It is '.unknownIdentity

In Nightly another similar problem is that, for example, if I select from the help menu "Troubleshooting information" the page that opens have '.unknownIdentity' and shows the globe in the identity box but if I reload the page with the stop and reload button the identity state of the page become '.chromeUI' and shows the firefox icon in the identity box
Tim, what do you think about landing this test now?
Attachment #772124 - Flags: review?(ttaubert)
Comment on attachment 772124 [details] [diff] [review]
browser-chrome test that reproduces the issue

>+  gNewWin = openDialog(getBrowserURL(), "_blank",
>+                          "chrome,dialog=no,location=yes,toolbar=yes", "about:home");

OpenBrowserWindow()

>+  ok(gNewWin, "got new window");
>+  whenDelayedStartupFinished(gNewWin, function() {
>+    let firstTab = gNewWin.gBrowser.selectedTab;
>+
>+    // This is being tracked by bug 882977.
>+    todo_is(getIdentityMode(), "chromeUI", "Identity should be chrome");

Delayed startup merely starts loading about:home. What makes you think the identity mode should already be updated by the time this check happens?

>+    is(getIdentityMode(), "unknownIdentity", "Identity should be chrome but is currently " +
>+                                             "shown as unknownIdentity for new windows.");

Given the above todo_is, what's the point of this?
Attachment #772124 - Flags: review?(ttaubert) → review-
(In reply to Dão Gottwald [:dao] from comment #6)
> >+    is(getIdentityMode(), "unknownIdentity", "Identity should be chrome but is currently " +
> >+                                             "shown as unknownIdentity for new windows.");
> 
> Given the above todo_is, what's the point of this?

Because while todo_is checks that the value isn't passing, it doesn't verify that the value isn't changing between test runs. If the test starts showing that about:home is having an identity mode of something other than unknownIdentity, while not chromeUI, then that would be a worthwhile issue to note.
(In reply to Jared Wein [:jaws] from comment #7)
> (In reply to Dão Gottwald [:dao] from comment #6)
> > >+    is(getIdentityMode(), "unknownIdentity", "Identity should be chrome but is currently " +
> > >+                                             "shown as unknownIdentity for new windows.");
> > 
> > Given the above todo_is, what's the point of this?
> 
> Because while todo_is checks that the value isn't passing, it doesn't verify
> that the value isn't changing between test runs. If the test starts showing
> that about:home is having an identity mode of something other than
> unknownIdentity, while not chromeUI, then that would be a worthwhile issue
> to note.

But I see now that with the is() check, the todo_is() is no longer necessary.
Addressed feedback.
Attachment #772124 - Attachment is obsolete: true
Attachment #772130 - Flags: review?(dao)
Comment on attachment 772130 [details] [diff] [review]
browser-chrome test that reproduces the issue v.2

>+  whenDelayedStartupFinished(win, function() {
>+    let browser = win.gBrowser.selectedBrowser;
>+    if (browser.contentDocument.readyState === "complete") {
>+      checkIdentityMode(win);
>+      return;
>+    }

The strict type checking of === isn't useful here, please use the way more common ==.

Are you sure this isn't racing anymore? When starting to load something, document.readyState is still "complete" for the previously loaded document (e.g. about:blank).
(In reply to Dão Gottwald [:dao] from comment #10)
> Comment on attachment 772130 [details] [diff] [review]
> browser-chrome test that reproduces the issue v.2
> 
> >+  whenDelayedStartupFinished(win, function() {
> >+    let browser = win.gBrowser.selectedBrowser;
> >+    if (browser.contentDocument.readyState === "complete") {
> >+      checkIdentityMode(win);
> >+      return;
> >+    }
> 
> The strict type checking of === isn't useful here, please use the way more
> common ==.

I brought this over from http://mxr.mozilla.org/mozilla-central/source/browser/base/content/test/head.js#216.
Yes, there's existing code where === is used for no specific reason, but == is still more common.
Attachment #772130 - Attachment is obsolete: true
Attachment #772130 - Flags: review?(dao)
Forgot to undo a debug change.
Attachment #772377 - Attachment is obsolete: true
Attachment #772377 - Flags: review?(dao)
Attachment #772380 - Flags: review?(dao)
Comment on attachment 772380 [details] [diff] [review]
browser-chrome test that reproduces the issue v.3.1

>+  registerCleanupFunction(function() {
>+    Services.prefs.clearUserPref("browser.startup.homepage");
>+    Services.prefs.clearUserPref("browser.startup.page");
>+  });

move win.close() here?
Attachment #772380 - Flags: review?(dao) → review+
Backed out for perma-oranging "Bug 885965 - Intermittent browser_typeAheadFind.js | Test timed out | Found a browser window after previous test timed out".

https://hg.mozilla.org/integration/fx-team/rev/fc3f64be0c1a
Depends on: 885965
Whiteboard: [leave open]
Depends on: 893424
Assignee: nobody → jaws
Depends on: 894519
No longer depends on: 894519
Flags: in-testsuite+
Whiteboard: [leave open] → fixed by bug 893424
Target Milestone: --- → Firefox 25
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Depends on: 894519
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: