Bug 1146929 - Remove support for the old style call hash based urls from the Loop standalone UI. r=mikedeboer
authorMark Banner <standard8@mozilla.com>
Wed, 25 Mar 2015 17:08:15 +0000
changeset 266020 f3310c79590e45cf54e4bfcd6834bcc1ca7b2ac2
parent 266019 d9b8636d515b640a0c095912ce1aadefc6f807a8
child 266021 c5bce379c5378d966051b55f2001f2dba329218c
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1146929
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1146929 - Remove support for the old style call hash based urls from the Loop standalone UI. r=mikedeboer
browser/components/loop/standalone/content/js/standaloneAppStore.js
browser/components/loop/standalone/content/js/webapp.js
browser/components/loop/standalone/content/js/webapp.jsx
browser/components/loop/test/standalone/standaloneAppStore_test.js
browser/components/loop/test/standalone/webapp_test.js
--- a/browser/components/loop/standalone/content/js/standaloneAppStore.js
+++ b/browser/components/loop/standalone/content/js/standaloneAppStore.js
@@ -12,18 +12,17 @@ loop.store = loop.store || {};
  * the window data and store the window type.
  */
 loop.store.StandaloneAppStore = (function() {
   "use strict";
 
   var sharedActions = loop.shared.actions;
   var sharedUtils = loop.shared.utils;
 
-  var OLD_STYLE_CALL_REGEXP = /\#call\/(.*)/;
-  var NEW_STYLE_CALL_REGEXP = /\/c\/([\w\-]+)$/;
+  var CALL_REGEXP = /\/c\/([\w\-]+)$/;
   var ROOM_REGEXP = /\/([\w\-]+)$/;
 
   /**
    * Constructor
    *
    * @param {Object} options Options for the store. Should contain the dispatcher.
    */
   var StandaloneAppStore = function(options) {
@@ -75,19 +74,17 @@ loop.store.StandaloneAppStore = (functio
         var match = path.match(regexp);
         if (match && match[1]) {
           return match;
         }
         return null;
       }
 
       if (windowPath) {
-        // Is this a call url (the hash is a backwards-compatible url)?
-        match = extractId(windowPath, OLD_STYLE_CALL_REGEXP) ||
-                extractId(windowPath, NEW_STYLE_CALL_REGEXP);
+        match = extractId(windowPath, CALL_REGEXP);
 
         if (match) {
           windowType = "outgoing";
         } else {
           // Is this a room url?
           match = extractId(windowPath, ROOM_REGEXP);
 
           if (match) {
--- a/browser/components/loop/standalone/content/js/webapp.js
+++ b/browser/components/loop/standalone/content/js/webapp.js
@@ -1104,19 +1104,17 @@ loop.webapp = (function($, _, OT, mozL10
     // Set the 'lang' and 'dir' attributes to <html> when the page is translated
     document.documentElement.lang = mozL10n.language.code;
     document.documentElement.dir = mozL10n.language.direction;
     document.title = mozL10n.get("clientShortname2");
 
     var locationData = sharedUtils.locationData();
 
     dispatcher.dispatch(new sharedActions.ExtractTokenInfo({
-      // We pass the hash or the pathname - the hash was used for the original
-      // urls, the pathname for later ones.
-      windowPath: locationData.hash || locationData.pathname
+      windowPath: locationData.pathname
     }));
   }
 
   return {
     CallUrlExpiredView: CallUrlExpiredView,
     PendingConversationView: PendingConversationView,
     GumPromptConversationView: GumPromptConversationView,
     WaitingConversationView: WaitingConversationView,
--- a/browser/components/loop/standalone/content/js/webapp.jsx
+++ b/browser/components/loop/standalone/content/js/webapp.jsx
@@ -1104,19 +1104,17 @@ loop.webapp = (function($, _, OT, mozL10
     // Set the 'lang' and 'dir' attributes to <html> when the page is translated
     document.documentElement.lang = mozL10n.language.code;
     document.documentElement.dir = mozL10n.language.direction;
     document.title = mozL10n.get("clientShortname2");
 
     var locationData = sharedUtils.locationData();
 
     dispatcher.dispatch(new sharedActions.ExtractTokenInfo({
-      // We pass the hash or the pathname - the hash was used for the original
-      // urls, the pathname for later ones.
-      windowPath: locationData.hash || locationData.pathname
+      windowPath: locationData.pathname
     }));
   }
 
   return {
     CallUrlExpiredView: CallUrlExpiredView,
     PendingConversationView: PendingConversationView,
     GumPromptConversationView: GumPromptConversationView,
     WaitingConversationView: WaitingConversationView,
--- a/browser/components/loop/test/standalone/standaloneAppStore_test.js
+++ b/browser/components/loop/test/standalone/standaloneAppStore_test.js
@@ -119,26 +119,17 @@ describe("loop.store.StandaloneAppStore"
         fakeSdk.checkSystemRequirements.returns(false);
 
         store.extractTokenInfo(
           new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
         expect(store.getStoreState().windowType).eql("unsupportedBrowser");
       });
 
-    it("should set windowType to `outgoing` for old style call hashes", function() {
-      fakeGetWindowData.windowPath = "#call/faketoken";
-
-      store.extractTokenInfo(
-        new sharedActions.ExtractTokenInfo(fakeGetWindowData));
-
-      expect(store.getStoreState().windowType).eql("outgoing");
-    });
-
-    it("should set windowType to `outgoing` for new style call paths", function() {
+    it("should set windowType to `outgoing` for call paths", function() {
       fakeGetWindowData.windowPath = "/c/fakecalltoken";
 
       store.extractTokenInfo(
         new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
       expect(store.getStoreState().windowType).eql("outgoing");
     });
 
@@ -155,30 +146,17 @@ describe("loop.store.StandaloneAppStore"
       fakeGetWindowData.windowPath = "/";
 
       store.extractTokenInfo(
         new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
       expect(store.getStoreState().windowType).eql("home");
     });
 
-    it("should set the loopToken on the conversation for old style call hashes",
-      function() {
-        fakeGetWindowData.windowPath = "#call/faketoken";
-
-        store.extractTokenInfo(
-          new sharedActions.ExtractTokenInfo(fakeGetWindowData));
-
-        sinon.assert.calledOnce(fakeConversation.set);
-        sinon.assert.calledWithExactly(fakeConversation.set, {
-          loopToken: "faketoken"
-        });
-      });
-
-    it("should set the loopToken on the conversation for new style call paths",
+    it("should set the loopToken on the conversation for call paths",
       function() {
         fakeGetWindowData.windowPath = "/c/fakecalltoken";
 
         store.extractTokenInfo(
           new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
         sinon.assert.calledOnce(fakeConversation.set);
         sinon.assert.calledWithExactly(fakeConversation.set, {
@@ -194,32 +172,17 @@ describe("loop.store.StandaloneAppStore"
           new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
         sinon.assert.calledOnce(fakeConversation.set);
         sinon.assert.calledWithExactly(fakeConversation.set, {
           loopToken: "fakeroomtoken"
         });
       });
 
-    it("should dispatch a SetupWindowData action for old style call hashes",
-      function() {
-        fakeGetWindowData.windowPath = "#call/faketoken";
-
-        store.extractTokenInfo(
-          new sharedActions.ExtractTokenInfo(fakeGetWindowData));
-
-        sinon.assert.calledOnce(dispatcher.dispatch);
-        sinon.assert.calledWithExactly(dispatcher.dispatch,
-          new sharedActions.FetchServerData({
-            windowType: "outgoing",
-            token: "faketoken"
-          }));
-      });
-
-    it("should set the loopToken on the conversation for new style call paths",
+    it("should set the loopToken on the conversation for call paths",
       function() {
         fakeGetWindowData.windowPath = "/c/fakecalltoken";
 
         store.extractTokenInfo(
           new sharedActions.ExtractTokenInfo(fakeGetWindowData));
 
         sinon.assert.calledOnce(dispatcher.dispatch);
         sinon.assert.calledWithExactly(dispatcher.dispatch,
--- a/browser/components/loop/test/standalone/webapp_test.js
+++ b/browser/components/loop/test/standalone/webapp_test.js
@@ -66,32 +66,17 @@ describe("loop.webapp", function() {
       sinon.assert.calledOnce(React.render);
       sinon.assert.calledWith(React.render,
         sinon.match(function(value) {
           return TestUtils.isCompositeComponentElement(value,
             loop.webapp.WebappRootView);
       }));
     });
 
-    it("should dispatch a ExtractTokenInfo action with the hash", function() {
-      sandbox.stub(loop.shared.utils, "locationData").returns({
-        hash: "#call/faketoken",
-        pathname: "invalid"
-      });
-
-      loop.webapp.init();
-
-      sinon.assert.calledOnce(loop.Dispatcher.prototype.dispatch);
-      sinon.assert.calledWithExactly(loop.Dispatcher.prototype.dispatch,
-        new sharedActions.ExtractTokenInfo({
-          windowPath: "#call/faketoken"
-        }));
-    });
-
-    it("should dispatch a ExtractTokenInfo action with the path if there is no hash",
+    it("should dispatch a ExtractTokenInfo action with the path",
       function() {
         sandbox.stub(loop.shared.utils, "locationData").returns({
           hash: "",
           pathname: "/c/faketoken"
         });
 
       loop.webapp.init();