From 8602728725bb645494cb3bb3e06515ab45476376 Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Tue, 10 Mar 2015 10:43:44 +0100 Subject: [PATCH] Bug 1141059: ignore attempts to share e10s tabs in a Hello conversation. r=Standard8 --- browser/components/loop/MozLoopAPI.jsm | 9 +++++++++ .../loop/content/shared/js/activeRoomStore.js | 3 +++ .../loop/test/shared/activeRoomStore_test.js | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/browser/components/loop/MozLoopAPI.jsm b/browser/components/loop/MozLoopAPI.jsm index aedc2beb5948..06aa3047a233 100644 --- a/browser/components/loop/MozLoopAPI.jsm +++ b/browser/components/loop/MozLoopAPI.jsm @@ -292,6 +292,15 @@ function injectLoopAPI(targetWindow) { listener(cloneValueInto(err, targetWindow)); return; } + if (browser.getAttribute("remote") == "true") { + // Tab sharing is not supported yet for e10s-enabled browsers. This will + // be fixed in bug 1137634. + let err = new Error("Tab sharing is not supported for e10s-enabled browsers"); + MozLoopService.log.error(err); + listener(cloneValueInto(err, targetWindow)); + return; + } + win.LoopUI.addBrowserSharingListener(listener); savedWindowListeners.set(listener, Cu.getWeakReference(win)); diff --git a/browser/components/loop/content/shared/js/activeRoomStore.js b/browser/components/loop/content/shared/js/activeRoomStore.js index 717861106059..0f1f73cb7003 100644 --- a/browser/components/loop/content/shared/js/activeRoomStore.js +++ b/browser/components/loop/content/shared/js/activeRoomStore.js @@ -421,6 +421,9 @@ loop.store.ActiveRoomStore = (function() { _handleSwitchBrowserShare: function(err, windowId) { if (err) { console.error("Error getting the windowId: " + err); + this.dispatchAction(new sharedActions.ScreenSharingState({ + state: SCREEN_SHARE_STATES.INACTIVE + })); return; } diff --git a/browser/components/loop/test/shared/activeRoomStore_test.js b/browser/components/loop/test/shared/activeRoomStore_test.js index 260d9b428b2c..60e05429f513 100644 --- a/browser/components/loop/test/shared/activeRoomStore_test.js +++ b/browser/components/loop/test/shared/activeRoomStore_test.js @@ -831,6 +831,18 @@ describe("loop.store.ActiveRoomStore", function () { sinon.assert.calledOnce(fakeSdkDriver.switchAcquiredWindow); sinon.assert.calledWithExactly(fakeSdkDriver.switchAcquiredWindow, 72); }); + + it("should end the screen sharing session when the listener receives an error", function() { + listener(new Error("foo")); + + // The dispatcher was already called once in beforeEach(). + sinon.assert.calledTwice(dispatcher.dispatch); + sinon.assert.calledWith(dispatcher.dispatch, + new sharedActions.ScreenSharingState({ + state: SCREEN_SHARE_STATES.INACTIVE + })); + sinon.assert.notCalled(fakeSdkDriver.switchAcquiredWindow); + }); }); describe("#endScreenShare", function() {