Closed Bug 1055507 Opened 10 years ago Closed 10 years ago

Ctrl+Tab doesn't switch tabs in e10s mode

Categories

(Firefox :: Tabbed Browser, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 34
Tracking Status
e10s ? ---

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Are there any errors in the browser console?

Does browser.ctrlTab.previews make a difference?
Blocks: fxe10s
(In reply to Dão Gottwald [:dao] from comment #1)
> Are there any errors in the browser console?

Yes:

TypeError: Argument 1 of CanvasRenderingContext2D.drawWindow does not implement interface Window. browser.js:6743

> Does browser.ctrlTab.previews make a difference?

That is actually what triggers the bug.  :-)  We're trying to pass a window from the content process to drawWindow in the chrome process.  I'll see if I can fix this.
Comment on attachment 8475298 [details] [diff] [review]
Eat the exception thrown from drawWindow in e10s mode when using tab previews; r=dao

This fixes tab switching for me, but of course gives black screenshots in the tab preview dialog.  I think that's fine for now since this is not a pref that is enabled by default.  I can file a follow-up bug for fixing the screenshots.
Attachment #8475298 - Flags: review?(dao)
Comment on attachment 8475298 [details] [diff] [review]
Eat the exception thrown from drawWindow in e10s mode when using tab previews; r=dao

I'm not the hugest fan of silently eating exceptions. Is it worth putting something in the console with Cu.reportError here? Or perhaps making sure we only eat these exceptions if gMultiProcessBrowser is true?
Yeah, I think we should just skip over the tab preview code entirely in e10s.
(In reply to Mike Conley (:mconley) from comment #5)
> Comment on attachment 8475298 [details] [diff] [review]
> Eat the exception thrown from drawWindow in e10s mode when using tab
> previews; r=dao
> 
> I'm not the hugest fan of silently eating exceptions. Is it worth putting
> something in the console with Cu.reportError here? Or perhaps making sure we
> only eat these exceptions if gMultiProcessBrowser is true?

You mean rethrow |e| if (!gMultiProcessBrowser)?  Can I just access |gMultiProcessBrowser| from this code?
Flags: needinfo?(mconley)
Yes, gMultiProcessBrowser will be accessible from here. Maybe just have capture return early if gMultiProcessBrowser is true.
Flags: needinfo?(mconley)
(In reply to Bill McCloskey (:billm) from comment #6)
> Yeah, I think we should just skip over the tab preview code entirely in e10s.

I looked into doing that briefly, but the issue is that the tab switching code (living in ctrlTab.advanceFocus for example) is pretty intertwined with the tab preview code, and I couldn't find an easy way to disentangle them without basically rewriting the entire component...
(In reply to Mike Conley (:mconley) from comment #8)
> Yes, gMultiProcessBrowser will be accessible from here. Maybe just have
> capture return early if gMultiProcessBrowser is true.

Return what though?  Its caller (tabPreviews.get) expects capture to return a DOM element.  Returning an "empty" canvas is effectively what my patch does now.
Flags: needinfo?(mconley)
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #10)
> (In reply to Mike Conley (:mconley) from comment #8)
> > Yes, gMultiProcessBrowser will be accessible from here. Maybe just have
> > capture return early if gMultiProcessBrowser is true.
> 
> Return what though?  Its caller (tabPreviews.get) expects capture to return
> a DOM element.  Returning an "empty" canvas is effectively what my patch
> does now.

Right, but it also eats and exceptions that might get raised in drawWindow for non-e10s windows.

Maybe the best approach would be just to wrap all of that canvas[1] stuff in a conditional checking gMultiProcessBrowser, and just skip over it if true.

[1]: http://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser-tabPreviews.js?from=browser-tabPreviews.js#61-67
Flags: needinfo?(mconley)
This is basically bug 698371. And no, I don't think we should just eat the exception.
Depends on: 698371
(In reply to Dão Gottwald [:dao] from comment #12)
> This is basically bug 698371. And no, I don't think we should just eat the
> exception.

OK, so do you agree with comment 11?
Flags: needinfo?(dao)
Ideally we'd just fix bug 698371, which sooner or later needs to happen anyway. Whether we should add a workaround here in the meantime depends on whether we consider this essential for getting e10s tested by nightly users. Since it's behind a hidden pref, I'm not convinced of this.
Flags: needinfo?(dao)
(In reply to Dão Gottwald [:dao] from comment #14)
> Ideally we'd just fix bug 698371, which sooner or later needs to happen
> anyway. Whether we should add a workaround here in the meantime depends on
> whether we consider this essential for getting e10s tested by nightly users.
> Since it's behind a hidden pref, I'm not convinced of this.

Well it gets in the way of my dogfooding, which is why I filed this.  As things stand currently, I can only tab switch using the mouse, or through Cmd+Alt+Left/Right, both of which will be things that will cause me to stop testing e10s in my main browser when I get tired of tab switching not working...
(Note that we have the option of backing out the patch here when bug 698371 gets fixed.  I'm not suggesting that we should *ship* the code that disables screenshotting like this.)
I'm not opposed to adding a gMultiProcessBrowser check. Just make sure you also add a comment pointing to bug 698371.
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #15)
> Well it gets in the way of my dogfooding, which is why I filed this.  As
> things stand currently, I can only tab switch using the mouse, or through
> Cmd+Alt+Left/Right, both of which will be things that will cause me to stop
> testing e10s in my main browser when I get tired of tab switching not
> working...

Can you just turn off the pref? That should make ctrl-tab work fine, but without thumbnails, which seems similar to what you would get with this patch.
(In reply to Bill McCloskey (:billm) from comment #18)
> Can you just turn off the pref? That should make ctrl-tab work fine, but
> without thumbnails, which seems similar to what you would get with this
> patch.

No, the UI with the thumbnails also lets you switch tabs in most recently used order.
Attachment #8475298 - Flags: review?(dao) → review-
(In reply to Dão Gottwald [:dao] from comment #19)
> (In reply to Bill McCloskey (:billm) from comment #18)
> > Can you just turn off the pref? That should make ctrl-tab work fine, but
> > without thumbnails, which seems similar to what you would get with this
> > patch.
> 
> No, the UI with the thumbnails also lets you switch tabs in most recently
> used order.

Yes, which is the reason why I have that pref turned on.  I can already get the usual Ctrl+Tab behavior by Cmd+Alt+Left/Right, but The Right Way to switch tabs is MRU.  ;-)
Attachment #8475298 - Attachment is obsolete: true
Attachment #8476055 - Flags: review?(dao)
Comment on attachment 8476055 [details] [diff] [review]
Avoid calling drawWindow in e10s mode when using tab previews until bug 698371 gets fixed; r=dao

>-    var ctx = thumbnail.getContext("2d");
>-    var win = aTab.linkedBrowser.contentWindow;
>-    var snippetWidth = win.innerWidth * .6;
>-    var scale = this.width / snippetWidth;
>-    ctx.scale(scale, scale);
>-    ctx.drawWindow(win, win.scrollX, win.scrollY,
>-                   snippetWidth, snippetWidth * this.aspectRatio, "rgb(255,255,255)");
>+    // This check should be removed once bug 698371 gets fixed.
>+    if (!gMultiProcessBrowser) {
>+      var ctx = thumbnail.getContext("2d");
>+      var win = aTab.linkedBrowser.contentWindow;
>+      var snippetWidth = win.innerWidth * .6;
>+      var scale = this.width / snippetWidth;
>+      ctx.scale(scale, scale);
>+      ctx.drawWindow(win, win.scrollX, win.scrollY,
>+                     snippetWidth, snippetWidth * this.aspectRatio, "rgb(255,255,255)");
>+    }

A more lightweight way to do this without reindenting existing code:

    // drawWindow doesn't yet work with e10s (bug 698371)
    if (gMultiProcessBrowser)
      return thumbnail;

    var ctx = thumbnail.getContext("2d");
    ...

The only difference is that we would never set aTab.__thumbnail, but that should be fine as that cache isn't useful anyway without drawWindow.
Attachment #8476055 - Flags: review?(dao) → review+
https://hg.mozilla.org/mozilla-central/rev/e024c7a1fef9
Assignee: nobody → ehsan
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Flags: qe-verify+
Verified: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Verified for MacOSX 10.8.5 on 34.0a2.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: