Closed Bug 1000894 Opened 5 years ago Closed 5 years ago

dom/tests/browser/browser_focus_steal_from_chrome{,_during_mousedown}.js destroy the original tab

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla31
Tracking Status
firefox30 --- fixed
firefox31 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

We're trying to make tests not do that, see bug 805068.

The test browser_focus_steal_from_chrome.js only cares about two tabs, so I tried the obvious:

@@ -8,7 +8,7 @@ function test() {
   let fm = Components.classes["@mozilla.org/focus-manager;1"]
                      .getService(Components.interfaces.nsIFocusManager);
 
-  let tabs = [ gBrowser.selectedTab, gBrowser.addTab() ];
+  let tabs = [ gBrowser.addTab(), gBrowser.addTab() ];
 
   let testingList = [
     { uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><input id='target'></body>",

so that the test is using its own newly created tabs, but that causes all sorts of interesting failures like:

TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/dom/tests/browser/browser_focus_steal_from_chrome.js | the INPUT element isn't focused by the focus (Test1: content can steal focus) - Got null, expected [object XrayWrapper [object HTMLInputElement]]
TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/dom/tests/browser/browser_focus_steal_from_chrome.js | the INPUT element isn't focused by the select (Test1: content can steal focus) - Got [object HTMLInputElement], expected [object XrayWrapper [object HTMLInputElement]]
TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/dom/tests/browser/browser_focus_steal_from_chrome.js | the A element isn't focused by the focus (Test1: content can steal focus) - Got [object HTMLInputElement], expected about:blank
TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/dom/tests/browser/browser_focus_steal_from_chrome.js | the BUTTON element isn't focused by the focus (Test1: content can steal focus) - Got [object HTMLInputElement], expected [object XrayWrapper [object HTMLButtonElement]] 
...and a couple more...

I guess because the new tab(s) aren't chrome tabs, but content tabs...or something like that?
Don't you also have to select the first tab?
(In reply to :Gavin Sharp (email gavin@gavinsharp.com) from comment #1)
> Don't you also have to select the first tab?

Oh, duh, that would help, wouldn't it...
Thanks for pointing out the problem, Gavin!
Attachment #8412321 - Flags: review?(ehsan)
Attachment #8412321 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/16a37bafa5c8
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
No longer blocks: 805068
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.