Bug 939445 - general.appname.override has stopped working. r=smaug, a=lsblakk
authorRobert Longson <longsonr@gmail.com>
Sun, 17 Nov 2013 23:10:15 +0000
changeset 167544 b718ba279b1ae0fc0a1859ce9e89ab70bdbc4672
parent 167543 edc3765d2780b560ff80b9ec8bb45e42ce9ef02e
child 167545 85c967274d60d3a760e926b21f371bca3561a353
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lsblakk
bugs939445
milestone27.0a2
Bug 939445 - general.appname.override has stopped working. r=smaug, a=lsblakk
dom/base/Navigator.cpp
dom/base/test/mochitest.ini
dom/base/test/test_appname_override.html
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1948,13 +1948,14 @@ void
 NS_GetNavigatorAppName(nsAString& aAppName)
 {
   if (!nsContentUtils::IsCallerChrome()) {
     const nsAdoptingString& override =
       mozilla::Preferences::GetString("general.appname.override");
 
     if (override) {
       aAppName = override;
+      return;
     }
   }
 
   aAppName.AssignLiteral("Netscape");
 }
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -1,15 +1,16 @@
 [DEFAULT]
 support-files =
   iframe_messageChannel_cloning.html
   iframe_messageChannel_pingpong.html
   iframe_messageChannel_post.html
 
 [test_Image_constructor.html]
+[test_appname_override.html]
 [test_bug913761.html]
 [test_constructor-assignment.html]
 [test_constructor.html]
 [test_document.all_unqualified.html]
 [test_domcursor.html]
 [test_domrequest.html]
 [test_e4x_for_each.html]
 [test_error.html]
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_appname_override.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=939445
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 939445 - general.appname.override</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=939445">Mozilla Bug 939445</a>
+  <script type="application/javascript">
+
+  function runTest() {
+    is(navigator.appName, "hello", "general.appname.override not working");
+
+    SimpleTest.finish();
+  }
+
+  SimpleTest.waitForExplicitFinish();
+  SpecialPowers.pushPrefEnv({"set": [["general.appname.override", "hello"]]}, runTest);
+  </script>
+</body>
+</html>