From 0433e146062b4058de06048d5b5e12133469561a Mon Sep 17 00:00:00 2001 From: "Adam Roach [:abr]" Date: Tue, 16 Sep 2014 06:46:11 -0700 Subject: [PATCH] Bug 1066816 - Allow OT toolkit to set GUID for analytics r=Standard8 --- browser/components/loop/content/js/conversation.js | 14 ++++++++++++++ .../components/loop/content/js/conversation.jsx | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/browser/components/loop/content/js/conversation.js b/browser/components/loop/content/js/conversation.js index fe7320a8f24..19cec5ecbce 100644 --- a/browser/components/loop/content/js/conversation.js +++ b/browser/components/loop/content/js/conversation.js @@ -455,6 +455,20 @@ loop.conversation = (function(OT, mozL10n) { // else to ensure the L10n environment is setup correctly. mozL10n.initialize(navigator.mozLoop); + // Plug in an alternate client ID mechanism, as localStorage and cookies + // don't work in the conversation window + if (OT && OT.hasOwnProperty("overrideGuidStorage")) { + OT.overrideGuidStorage({ + get: function(callback) { + callback(null, navigator.mozLoop.getLoopCharPref("ot.guid")); + }, + set: function(guid, callback) { + navigator.mozLoop.setLoopCharPref("ot.guid", guid); + callback(null); + } + }); + } + document.title = mozL10n.get("incoming_call_title2"); document.body.classList.add(loop.shared.utils.getTargetPlatform()); diff --git a/browser/components/loop/content/js/conversation.jsx b/browser/components/loop/content/js/conversation.jsx index e58fa3d54c3..27a9797ad74 100644 --- a/browser/components/loop/content/js/conversation.jsx +++ b/browser/components/loop/content/js/conversation.jsx @@ -455,6 +455,20 @@ loop.conversation = (function(OT, mozL10n) { // else to ensure the L10n environment is setup correctly. mozL10n.initialize(navigator.mozLoop); + // Plug in an alternate client ID mechanism, as localStorage and cookies + // don't work in the conversation window + if (OT && OT.hasOwnProperty("overrideGuidStorage")) { + OT.overrideGuidStorage({ + get: function(callback) { + callback(null, navigator.mozLoop.getLoopCharPref("ot.guid")); + }, + set: function(guid, callback) { + navigator.mozLoop.setLoopCharPref("ot.guid", guid); + callback(null); + } + }); + } + document.title = mozL10n.get("incoming_call_title2"); document.body.classList.add(loop.shared.utils.getTargetPlatform());