Bug 1098666 - Don't crash when getting this through CPOWs. r=billm
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 14 Nov 2014 14:41:59 -0800
changeset 215862 6039cbdd69a96a524280495945a8938376ce65b4
parent 215861 9b77a97a378b4a7cb7ef0ddc30093dc9f00879f6
child 215863 7fb233e1b1c4459395ee4c43ff4b5ce8fadd7e32
push id27829
push usergszorc@mozilla.com
push dateSat, 15 Nov 2014 22:34:49 +0000
treeherderautoland@19f75e1211e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1098666
milestone36.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 1098666 - Don't crash when getting this through CPOWs. r=billm
dom/base/SiteSpecificUserAgent.js
dom/base/test/chrome/cpows_parent.xul
--- a/dom/base/SiteSpecificUserAgent.js
+++ b/dom/base/SiteSpecificUserAgent.js
@@ -42,17 +42,17 @@ SiteSpecificUserAgent.prototype = {
 
     let host = aURI.asciiHost;
     let cachedResult = this.userAgentCache.get(host);
     if (cachedResult) {
       return cachedResult;
     }
 
     let data = { uri: aURI };
-    let result = cpmm.sendSyncMessage("Useragent:GetOverride", data)[0] || HTTP_PROTO_HANDLER.userAgent;
+    let result = cpmm.sendRpcMessage("Useragent:GetOverride", data)[0] || HTTP_PROTO_HANDLER.userAgent;
 
     if (this.userAgentCache.size >= MAX_CACHE_SIZE) {
       this.userAgentCache.clear();
     }
 
     this.userAgentCache.set(host, result);
     return result;
   },
--- a/dom/base/test/chrome/cpows_parent.xul
+++ b/dom/base/test/chrome/cpows_parent.xul
@@ -61,16 +61,17 @@
       is(Object.getOwnPropertyDescriptor(data, "doesn't exist"), undefined,
          "getOwnPropertyDescriptor returns undefined for non-existant properties");
       ok(Object.getOwnPropertyDescriptor(data, "i").value, 5,
          "getOwnPropertyDescriptor.value works");
       let obj = new data.ctor();
       ok(obj.a === 3, "constructor call");
       ok(document.title === "Hello, Kitty", "document node");
       is(typeof document.cookie, "string", "can get document.cookie");
+      is(typeof document.defaultView.navigator.userAgent, "string", "can get navigator.userAgent");
 
       data.i = 6;
       data.b = false;
       data.s = "bye";
       data.x = null;
       ok(data.i === 6, "integer property");
       ok(data.b === false, "boolean property");
       ok(data.s === "bye", "string property");