Bug 404077: Use navigator.platform.startsWith rather than navigator.platform.indexOf, at Jesse's suggestion.
authorL. David Baron <dbaron@dbaron.org>
Tue, 26 Feb 2013 22:23:08 -0800
changeset 133525 4440a63381608848edcc565cee7409c608ce9271
parent 133524 58890b4aadfb11b4073806bd6dbef20a9a086fb0
child 133526 672ce8b62c32bd111aeecc0aa50f0e6012e29820
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs404077
milestone22.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 404077: Use navigator.platform.startsWith rather than navigator.platform.indexOf, at Jesse's suggestion.
accessible/tests/mochitest/actions/test_general.xul
accessible/tests/mochitest/actions/test_link.html
accessible/tests/mochitest/attributes/test_obj.html
accessible/tests/mochitest/editabletext/test_1.html
accessible/tests/mochitest/events/test_focus_autocomplete.xul
accessible/tests/mochitest/events/test_focus_browserui.xul
accessible/tests/mochitest/events/test_focus_doc.html
accessible/tests/mochitest/relations/test_ui_modalprompt.html
accessible/tests/mochitest/text/test_singleline.html
accessible/tests/mochitest/text/test_whitespaces.html
accessible/tests/mochitest/text/test_words.html
accessible/tests/mochitest/tree/test_dockids.html
accessible/tests/mochitest/tree/test_txtctrl.xul
caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
content/base/test/test_mutationobservers.html
content/html/content/test/forms/test_meter_element.html
content/html/content/test/test_bug523771.html
content/html/document/test/test_bug391777.html
content/html/document/test/test_document-element-inserted.html
content/media/test/test_bug495300.html
content/media/test/test_bug686942.html
content/media/test/test_playback_rate.html
content/media/test/test_seek_out_of_range.html
docshell/test/chrome/test_mozFrameType.xul
docshell/test/navigation/test_child.html
docshell/test/navigation/test_grandchild.html
docshell/test/navigation/test_reserved.html
docshell/test/test_bug668513.html
dom/bindings/test/test_bug773326.html
dom/encoding/test/test_TextEncoder.html
dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_exceptions.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
dom/network/tests/test_tcpsocket_enabled_with_perm.html
dom/plugins/test/mochitest/test_GCrace.html
dom/plugins/test/mochitest/test_cookies.html
dom/plugins/test/mochitest/test_pluginstream_seek_close.html
dom/plugins/test/mochitest/test_twostreams.html
dom/tests/mochitest/bugs/test_bug291653.html
dom/tests/mochitest/bugs/test_bug406375.html
dom/tests/mochitest/bugs/test_bug414291.html
dom/tests/mochitest/bugs/test_bug437361.html
dom/tests/mochitest/bugs/test_bug504862.html
dom/tests/mochitest/chrome/test_focus.xul
dom/workers/test/test_fileReadSlice.xul
editor/libeditor/html/tests/test_bug674770-1.html
editor/libeditor/text/tests/test_bug638596.html
js/xpconnect/tests/mochitest/test_bug393269.html
layout/base/tests/chrome/test_printpreview.xul
layout/base/tests/chrome/test_printpreview_bug396024.xul
layout/base/tests/chrome/test_transformed_scrolling_repaints.html
layout/base/tests/test_bug93077-6.html
layout/base/tests/test_image_layers.html
layout/base/tests/test_mozPaintCount.html
layout/base/tests/test_reftests_with_caret.html
layout/base/tests/test_scroll_selection_into_view.html
layout/forms/test/test_bug536567_perwindowpb.html
layout/forms/test/test_bug665540.html
layout/generic/test/test_bug469613.xul
layout/generic/test/test_bug469774.xul
layout/generic/test/test_bug508115.xul
layout/generic/test/test_bug514732-2.xul
layout/generic/test/test_bug632379.xul
layout/generic/test/test_selection_underline.html
layout/style/test/test_pointer-events.html
security/manager/ssl/tests/mochitest/mixedcontent/test_cssContent2.html
toolkit/content/tests/chrome/test_bug437844.xul
toolkit/content/tests/chrome/test_bug509732.xul
toolkit/content/tests/chrome/test_bug557987.xul
toolkit/content/tests/chrome/test_bug562554.xul
toolkit/content/tests/chrome/test_bug570192.xul
toolkit/content/tests/chrome/test_bug585946.xul
toolkit/content/tests/chrome/test_bug624329.xul
toolkit/content/tests/chrome/test_bug792324.xul
toolkit/content/tests/chrome/test_button.xul
toolkit/content/tests/chrome/test_chromemargin.xul
toolkit/content/tests/chrome/test_closemenu_attribute.xul
toolkit/content/tests/chrome/test_colorpicker_popup.xul
toolkit/content/tests/chrome/test_contextmenu_list.xul
toolkit/content/tests/chrome/test_datepicker.xul
toolkit/content/tests/chrome/test_deck.xul
toolkit/content/tests/chrome/test_dialogfocus.xul
toolkit/content/tests/chrome/test_findbar_events.xul
toolkit/content/tests/chrome/test_focus_anons.xul
toolkit/content/tests/chrome/test_hiddenitems.xul
toolkit/content/tests/chrome/test_hiddenpaging.xul
toolkit/content/tests/chrome/test_keys.xul
toolkit/content/tests/chrome/test_largemenu.xul
toolkit/content/tests/chrome/test_menu.xul
toolkit/content/tests/chrome/test_menuchecks.xul
toolkit/content/tests/chrome/test_menuitem_blink.xul
toolkit/content/tests/chrome/test_menuitem_commands.xul
toolkit/content/tests/chrome/test_menulist_keynav.xul
toolkit/content/tests/chrome/test_mousecapture.xul
toolkit/content/tests/chrome/test_notificationbox.xul
toolkit/content/tests/chrome/test_panel.xul
toolkit/content/tests/chrome/test_preferences.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
widget/tests/test_bug538242.xul
--- a/accessible/tests/mochitest/actions/test_general.xul
+++ b/accessible/tests/mochitest/actions/test_general.xul
@@ -16,17 +16,17 @@
           src="../common.js" />
   <script type="application/javascript"
           src="../events.js" />
   <script type="application/javascript"
           src="../actions.js" />
 
   <script type="application/javascript">
   <![CDATA[
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     } else {
       SimpleTest.expectAssertions(1);
     }
 
     function doTest()
     {
       var actionsArray = [
--- a/accessible/tests/mochitest/actions/test_link.html
+++ b/accessible/tests/mochitest/actions/test_link.html
@@ -12,21 +12,21 @@
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
   <script type="application/javascript"
           src="../actions.js"></script>
 
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Win") == 0) {
+    if (navigator.platform.startsWith("Win")) {
       SimpleTest.expectAssertions(13);
-    } else if (navigator.platform.indexOf("Linux") == 0) {
+    } else if (navigator.platform.startsWith("Linux")) {
       SimpleTest.expectAssertions(18);
-    } else if (navigator.platform.indexOf("Mac") == 0) {
+    } else if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 14);
     }
 
     function getAnchorTargetDocumentAcc()
     {
       var thisTabDocAcc = getTabDocAccessible();
       var thisDocTabPanelAcc = thisTabDocAcc.parent.parent;
       var tabPanelsAcc = thisDocTabPanelAcc.parent;
--- a/accessible/tests/mochitest/attributes/test_obj.html
+++ b/accessible/tests/mochitest/attributes/test_obj.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../attributes.js"></script>
 
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Linux") == 0) {
+    if (navigator.platform.startsWith("Linux")) {
       SimpleTest.expectAssertions(0, 1);
     }
 
     function doTest()
     {
       // aria
       testAttrs("atomic", {"atomic" : "true"}, true);
       testAttrs("autocomplete", {"autocomplete" : "true"}, true);
--- a/accessible/tests/mochitest/editabletext/test_1.html
+++ b/accessible/tests/mochitest/editabletext/test_1.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
   <script type="application/javascript"
           src="editabletext.js"></script>
 
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 3);
     } else {
       SimpleTest.expectAssertions(3);
     }
 
     function addTestEditable(aID, aTestRun, aTrailChar)
     {
       var et = new editableTextTest(aID);
--- a/accessible/tests/mochitest/events/test_focus_autocomplete.xul
+++ b/accessible/tests/mochitest/events/test_focus_autocomplete.xul
@@ -27,17 +27,17 @@
   <script type="application/javascript"
           src="../events.js" />
 
   <script type="application/javascript"
           src="../autocomplete.js" />
 
   <script type="application/javascript">
   <![CDATA[
-    if (navigator.platform.indexOf("Mac") != 0) {
+    if (!navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(2);
     }
     ////////////////////////////////////////////////////////////////////////////
     // Hacky stuffs
 
     // This is the hack needed for searchbar work outside of browser.
     function getBrowser()
     {
--- a/accessible/tests/mochitest/events/test_focus_browserui.xul
+++ b/accessible/tests/mochitest/events/test_focus_browserui.xul
@@ -19,17 +19,17 @@
           src="../states.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
   <script type="application/javascript"
           src="../browser.js"></script>
 
   <script type="application/javascript">
   <![CDATA[
-    if (navigator.platform.indexOf("Linux") == 0) {
+    if (navigator.platform.startsWith("Linux")) {
       SimpleTest.expectAssertions(1);
     }
     ////////////////////////////////////////////////////////////////////////////
     // Helpers
 
     function inputInDocument()
     {
       var tabdoc = currentTabDocument();
--- a/accessible/tests/mochitest/events/test_focus_doc.html
+++ b/accessible/tests/mochitest/events/test_focus_doc.html
@@ -16,21 +16,21 @@
   <script type="application/javascript"
     src="../events.js"></script>
   <script type="application/javascript"
           src="../role.js"></script>
     <script type="application/javascript"
       src="../states.js"></script>
 
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Win") == 0) {
+    if (navigator.platform.startsWith("Win")) {
       SimpleTest.expectAssertions(1, 2);
-    } else if (navigator.platform.indexOf("Linux") == 0) {
+    } else if (navigator.platform.startsWith("Linux")) {
       SimpleTest.expectAssertions(1);
-    } else if (navigator.platform.indexOf("Mac") == 0) {
+    } else if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     }
 
     var gQueue = null;
 
     //var gA11yEventDumpID = "eventdump";
     //gA11yEventDumpToConsole = true;
 
--- a/accessible/tests/mochitest/relations/test_ui_modalprompt.html
+++ b/accessible/tests/mochitest/relations/test_ui_modalprompt.html
@@ -17,17 +17,17 @@
   <script type="application/javascript"
           src="../role.js"></script>
   <script type="application/javascript"
           src="../events.js"></script>
   <script type="application/javascript"
           src="../browser.js"></script>
 
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     } else {
       SimpleTest.expectAssertions(1);
     }
 
     function hasTabModalPrompts() {
       try {
         return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");
--- a/accessible/tests/mochitest/text/test_singleline.html
+++ b/accessible/tests/mochitest/text/test_singleline.html
@@ -6,17 +6,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../text.js"></script>
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 23);
     } else {
       SimpleTest.expectAssertions(23);
     }
 
     function doTest()
     {
       // __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
--- a/accessible/tests/mochitest/text/test_whitespaces.html
+++ b/accessible/tests/mochitest/text/test_whitespaces.html
@@ -8,17 +8,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript"
           src="../common.js"></script>
 
   <script type="application/javascript"
           src="../text.js"></script>
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 10);
     } else {
       SimpleTest.expectAssertions(10);
     }
 
     function doTest()
     {
       // __B__r__a__v__e__ __S__i__r__ __ __R__o__b__i__n__ __ __ __r__a__n
--- a/accessible/tests/mochitest/text/test_words.html
+++ b/accessible/tests/mochitest/text/test_words.html
@@ -7,17 +7,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../text.js"></script>
   <script type="application/javascript">
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     } else {
       SimpleTest.expectAssertions(1);
     }
 
     function doTest()
     {
       // "one two"
--- a/accessible/tests/mochitest/tree/test_dockids.html
+++ b/accessible/tests/mochitest/tree/test_dockids.html
@@ -11,17 +11,17 @@
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../role.js"></script>
   <script type="application/javascript"
           src="../states.js"></script>
 
   <script type="application/javascript">
-  if (navigator.platform.indexOf("Win") == 0) {
+  if (navigator.platform.startsWith("Win")) {
     SimpleTest.expectAssertions(0, 1);
   }
 
   function doTest()
   {
     var tree =
      { DOCUMENT: [
        { PARAGRAPH: [ // head
--- a/accessible/tests/mochitest/tree/test_txtctrl.xul
+++ b/accessible/tests/mochitest/tree/test_txtctrl.xul
@@ -13,17 +13,17 @@
           src="../common.js" />
   <script type="application/javascript"
           src="../role.js" />
   <script type="application/javascript"
           src="../events.js" />
 
   <script type="application/javascript">
   <![CDATA[
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 1);
     } else {
       SimpleTest.expectAssertions(1);
     }
     ////////////////////////////////////////////////////////////////////////////
     // Test
 
     function doTest()
--- a/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
+++ b/caps/tests/mochitest/test_principal_extendedorigin_appid_appstatus.html
@@ -17,17 +17,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.7">
 
 /** Test for Bug 758258 **/
 
 var Ci = Components.interfaces;
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 /*
  * gData is an array of objects. Each object represents a test case.
  * - app: gives the app manifest URL, will set mozapp to it on the iframe;
--- a/content/base/test/test_mutationobservers.html
+++ b/content/base/test/test_mutationobservers.html
@@ -13,17 +13,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=641821">Mozilla Bug 641821</a>
 <p id="display"></p>
 <div id="content" style="display: none">
                                 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   // for non-Windows
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 641821 **/
 
 var div = document.createElement("div");
 
--- a/content/html/content/test/forms/test_meter_element.html
+++ b/content/html/content/test/forms/test_meter_element.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="visibility: hidden;">
   <form id='f' method='get' target='submit_frame' action='foo'>
     <meter id='m' value=0.5></meter>
   </form>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 } else {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for <meter> **/
 
 function checkFormIDLAttribute(aElement)
--- a/content/html/content/test/test_bug523771.html
+++ b/content/html/content/test/test_bug523771.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <form action="form_submit_server.sjs" target="target_iframe" id="form"
 method="POST" enctype="multipart/form-data">
   <input id=singleFile name=singleFile type=file>
   <input id=multiFile name=multiFile type=file multiple>
 </form>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 } else {
   SimpleTest.expectAssertions(1);
 }
 
 var filesToKill = [];
 singleFileInput = document.getElementById('singleFile');
 multiFileInput = document.getElementById('multiFile');
--- a/content/html/document/test/test_bug391777.html
+++ b/content/html/document/test/test_bug391777.html
@@ -8,17 +8,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="text/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=391777">Mozilla Bug 391777</a>
 <p id="display"></p>
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   // not Windows
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 391777 **/
 var arg = {};
 arg.testVal = "foo";
 var result = window.showModalDialog("javascript:window.returnValue = window.dialogArguments.testVal; window.close(); 'This window should close on its own.';", arg);
--- a/content/html/document/test/test_document-element-inserted.html
+++ b/content/html/document/test/test_document-element-inserted.html
@@ -6,17 +6,17 @@
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <iframe id = 'media'>
 </iframe>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 4);
 }
 
 SimpleTest.waitForExplicitFinish();
 var loc;
 
 var observe = function(doc){
     if (doc == media.contentDocument) {
--- a/content/media/test/test_bug495300.html
+++ b/content/media/test/test_bug495300.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script type="text/javascript" src="manifest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=495300">Mozilla Bug 495300</a>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Mac") != 0) {
+if (!navigator.platform.startsWith("Mac")) {
   // not Mac
   SimpleTest.expectAssertions(0, 1);
 }
 
 var manager = new MediaTestManager;
 
 function filename(uri) {
   return uri.substr(uri.lastIndexOf("/")+1);
--- a/content/media/test/test_bug686942.html
+++ b/content/media/test/test_bug686942.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script type="text/javascript" src="manifest.js"></script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=686942">Mozilla Bug 686942</a>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 var manager = new MediaTestManager;
 
 function onloaded(event) {
   var v = event.target;
   v.currentTime = v.duration;
--- a/content/media/test/test_playback_rate.html
+++ b/content/media/test/test_playback_rate.html
@@ -5,17 +5,17 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script type="text/javascript" src="manifest.js"></script>
 </head>
 <body>
 <pre id="test">
 <script class="testbody" type='application/javascript;version=1.8'>
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 let manager = new MediaTestManager;
 
 function rangeCheck(lhs, rhs, threshold) {
   var diff = Math.abs(lhs - rhs);
   if (diff < threshold) {
--- a/content/media/test/test_seek_out_of_range.html
+++ b/content/media/test/test_seek_out_of_range.html
@@ -5,17 +5,17 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script type="text/javascript" src="manifest.js"></script>
 </head>
 <body>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 var manager = new MediaTestManager;
 
 // Test if the ended event works correctly.
 
 function startTest(e) {
--- a/docshell/test/chrome/test_mozFrameType.xul
+++ b/docshell/test/chrome/test_mozFrameType.xul
@@ -22,17 +22,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 /** Test for Bug 769771 **/
 SimpleTest.waitForExplicitFinish();
 
 addLoadEvent(function () {
   window.open("mozFrameType_window.xul", "mozFrameType",
--- a/docshell/test/navigation/test_child.html
+++ b/docshell/test/navigation/test_child.html
@@ -4,17 +4,17 @@
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     <script type="text/javascript" src="NavigationUtils.js"></script>        
     <style type="text/css">
       iframe { width: 90%; height: 50px; }
     </style>
 <script>
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 window.onload = function() {
   navigateByLocation(frames[0]);
   navigateByOpen("child1");
   navigateByForm("child2");
   navigateByHyperlink("child3");
--- a/docshell/test/navigation/test_grandchild.html
+++ b/docshell/test/navigation/test_grandchild.html
@@ -4,17 +4,17 @@
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     <script type="text/javascript" src="NavigationUtils.js"></script>        
     <style type="text/css">
       iframe { width: 90%; height: 200px; }
     </style>
 <script>
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 window.onload = function () {
   navigateByLocation(frames[0].frames[0]);
   navigateByOpen("child1_child0");
   navigateByForm("child2_child0");
   navigateByHyperlink("child3_child0");
--- a/docshell/test/navigation/test_reserved.html
+++ b/docshell/test/navigation/test_reserved.html
@@ -4,17 +4,17 @@
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
     <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     <script type="text/javascript" src="NavigationUtils.js"></script>        
     <style type="text/css">
       iframe { width: 90%; height: 200px; }
     </style>
 <script>
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 function testTop() {
   window0 = window.open("iframe.html#http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#top,location", "_blank", "width=10,height=10");
 
   xpcWaitForFinishedFrames(function() {
     isInaccessible(window0, "Should be able to navigate off-domain top by setting location.");
--- a/docshell/test/test_bug668513.html
+++ b/docshell/test/test_bug668513.html
@@ -3,17 +3,17 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=668513
 -->
 <head>
   <title>Test for Bug 668513</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 <script>
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
   function onload_test()
   {
     var win = frames[0];
     ok(win.performance, 'Window.performance should be defined');
     ok(win.performance.navigation, 'Window.performance.navigation should be defined');
--- a/dom/bindings/test/test_bug773326.html
+++ b/dom/bindings/test/test_bug773326.html
@@ -1,16 +1,16 @@
 <!doctype html>
 <meta charset=utf-8>
 <title>Test for Bug 773326</title>
 <script src=/resources/testharness.js></script>
 <script src=/resources/testharnessreport.js></script>
 <div id=log></div>
 <script>
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 } else {
   SimpleTest.expectAssertions(2);
 }
 test(function() {
   new Worker("data:text/javascript,new XMLHttpRequest(42)");
 }, "Should not crash")
 </script>
--- a/dom/encoding/test/test_TextEncoder.html
+++ b/dom/encoding/test/test_TextEncoder.html
@@ -7,17 +7,17 @@
   <script type="text/javascript" src="/resources/testharnessreport.js"></script>
   <script type="text/javascript" src="test_TextEncoder.js"></script>
   <script type="text/javascript" src="worker_helper.js"></script>
 </head>
 <body>
 <div id="log"></div>
 <script>
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 } else {
   SimpleTest.expectAssertions(2);
 }
 
 setup({explicit_done: true});
 runTest();
 
--- a/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Audio Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <audio id="testAudio"></audio>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
   /**
    * Run a test to verify that we can complete a start and stop media playback
    * cycle for an audio LocalMediaStream on an audio HTMLMediaElement.
    */
   runTest(function () {
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <video id="testVideo"></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
   /**
    * Run a test to verify that we can complete a start and stop media playback
    * cycle for an video LocalMediaStream on a video HTMLMediaElement.
    */
   runTest(function () {
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video & Audio Test</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <video id="testVideoAudio"></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
   /**
    * Run a test to verify that we can complete a start and stop media playback
    * cycle for a video and audio LocalMediaStream on a video HTMLMediaElement.
    */
   runTest(function () {
--- a/dom/media/tests/mochitest/test_getUserMedia_exceptions.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_exceptions.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795367">Test mozGetUserMedia Exceptions</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 /**
   These tests verify that the appropriate exception is thrown when incorrect
   values are provided to the immediate mozGetUserMedia call.
 */
 var exceptionTests = [
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Video Audio Stream</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <video id="testVideo"></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
   /**
    * Run a test to verify that we can start a video+audio stream in a
    * media element, call stop() on the stream, and successfully get an
    * ended event fired.
    */
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <video id="videoPCLocal" width="160" height="120" controls></video>
   <video id="videoPCRemote" width="160" height="120" controls></video>
   <video id="videoLocal" width="160" height="120" controls></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 9);
 } else {
   SimpleTest.expectAssertions(0, 1);
 }
 
   var audioLocal;
   var audioPCLocal;
   var audioPCRemote;
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <video id="videoPCLocal" width="160" height="120" controls></video>
   <video id="videoPCRemote" width="160" height="120" controls></video>
   <video id="videoLocal" width="160" height="120" controls></video>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") != 0) {
+if (!navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
   var audioLocal;
   var videoLocal;
   var videoPCLocal;
   var videoPCRemote;
 
--- a/dom/network/tests/test_tcpsocket_enabled_with_perm.html
+++ b/dom/network/tests/test_tcpsocket_enabled_with_perm.html
@@ -7,17 +7,17 @@
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 /** Test to ensure TCPSocket permission being turned on enables 
   navigator.mozTCPSocket, and mozTCPSocket.open works when
   the tcp-socket permission has been granted.
 **/
 SpecialPowers.setBoolPref("dom.mozTCPSocket.enabled", true);
--- a/dom/plugins/test/mochitest/test_GCrace.html
+++ b/dom/plugins/test/mochitest/test_GCrace.html
@@ -15,17 +15,17 @@
 
     function start() {
       if (!SimpleTest.testPluginIsOOP()) {
         ok(true, "Skipping this test when test plugin is not OOP.");
         SimpleTest.finish();
         return;
       }
       else {
-        if (navigator.platform.indexOf("Win") == 0) {
+        if (navigator.platform.startsWith("Win")) {
           SimpleTest.expectAssertions(0, 66);
         } else {
           SimpleTest.expectAssertions(0, 1);
         }
 
         setTimeout(checkGCRace, 1000);
       }
     }
--- a/dom/plugins/test/mochitest/test_cookies.html
+++ b/dom/plugins/test/mochitest/test_cookies.html
@@ -2,17 +2,17 @@
 <head>
   <title>NPAPI Cookie Tests</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 
 <body onload="runTests()">
   <embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
   <script class="testbody" type="application/javascript">
-if (navigator.platform.indexOf("Mac") != 0) {
+if (!navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(1);
 }
     SimpleTest.waitForExplicitFinish();
     function runTests() {
       var pluginElement = document.getElementById("plugin1");
       pluginElement.setCookie("foo");
       is(pluginElement.getCookie(), "foo", "Cookie was set and retrieved correctly via NPAPI.");
       SimpleTest.finish();
--- a/dom/plugins/test/mochitest/test_pluginstream_seek_close.html
+++ b/dom/plugins/test/mochitest/test_pluginstream_seek_close.html
@@ -1,17 +1,17 @@
 <body>
 <head>
   <title>NPAPI Seekable NPStream Test</title>
   <script type="text/javascript" 
           src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" 
         href="/tests/SimpleTest/test.css" />
 <script>
-  if (navigator.platform.indexOf("Linux") == 0) {
+  if (navigator.platform.startsWith("Linux")) {
     SimpleTest.expectAssertions(0, 1);
   }
 
   SimpleTest.waitForExplicitFinish();
 
   function frameLoaded() {
     var testframe = document.getElementById('testframe');
     var content = testframe.contentDocument.body.innerHTML;
--- a/dom/plugins/test/mochitest/test_twostreams.html
+++ b/dom/plugins/test/mochitest/test_twostreams.html
@@ -5,17 +5,17 @@
           src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" 
         href="/tests/SimpleTest/test.css" />
 </head>
 <body>
   <p id="display"></p>
 
   <script type="text/javascript">
-  if (navigator.platform.indexOf("Win") == 0) {
+  if (navigator.platform.startsWith("Win")) {
     SimpleTest.expectAssertions(1, 2);
   } else {
     SimpleTest.expectAssertions(1);
   }
 
   SimpleTest.waitForExplicitFinish();
 
   var framesToLoad = 2;
--- a/dom/tests/mochitest/bugs/test_bug291653.html
+++ b/dom/tests/mochitest/bugs/test_bug291653.html
@@ -12,17 +12,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=291653">Mozilla Bug 291653</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 291653 **/
 SimpleTest.waitForExplicitFinish();
 
 var secondListenerDidRun = false;
 
--- a/dom/tests/mochitest/bugs/test_bug406375.html
+++ b/dom/tests/mochitest/bugs/test_bug406375.html
@@ -12,19 +12,19 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=406375">Mozilla Bug 406375</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(3);
-} else if (navigator.platform.indexOf("Linux") == 0) {
+} else if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 406375 **/
 
 
 SimpleTest.waitForExplicitFinish();
 
--- a/dom/tests/mochitest/bugs/test_bug414291.html
+++ b/dom/tests/mochitest/bugs/test_bug414291.html
@@ -7,17 +7,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 414291</title>
   <script type="text/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=414291">Mozilla Bug 414291</a>
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 414291 **/
 
 var result1 = 0;
 var result2 = 0;
 var result3 = 0;
--- a/dom/tests/mochitest/bugs/test_bug437361.html
+++ b/dom/tests/mochitest/bugs/test_bug437361.html
@@ -5,17 +5,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 -->
 <head>
   <title>Test for Bug 437361</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   
   <script class="testbody" type="text/javascript">
 
-  if (navigator.platform.indexOf("Win") != 0) {
+  if (!navigator.platform.startsWith("Win")) {
     SimpleTest.expectAssertions(1);
   }
 
   /** Test for Bug 437361 **/
 
   function testModalDialogBlockedCleanly() {
     is(true, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
     var rv = window.showModalDialog( // should be blocked without exception
--- a/dom/tests/mochitest/bugs/test_bug504862.html
+++ b/dom/tests/mochitest/bugs/test_bug504862.html
@@ -7,17 +7,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 504862</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body onload="runTest()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504862">Mozilla Bug 504862</a>
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 504862 **/
 SimpleTest.waitForExplicitFinish();
 function onMsgRcv(event)
 {
   is(event.data, "args: undefined", "Unexpected cross origin dialog arguments.");
--- a/dom/tests/mochitest/chrome/test_focus.xul
+++ b/dom/tests/mochitest/chrome/test_focus.xul
@@ -5,17 +5,17 @@
 <window title="Focus Tests"
   onload="setTimeout(runTest, 0);"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
 <script>
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 SimpleTest.waitForExplicitFinish();
 function runTest()
 {
   window.open("window_focus.xul", "_blank", "chrome,width=600,height=550");
 }
--- a/dom/workers/test/test_fileReadSlice.xul
+++ b/dom/workers/test/test_fileReadSlice.xul
@@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   </div>
 
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
 
-  if (navigator.platform.indexOf("Win") == 0) {
+  if (navigator.platform.startsWith("Win")) {
     SimpleTest.expectAssertions(0, 1);
   }
 
   /** Test for Bug 664783 **/
 
   var fileNum = 0;
 
   /**
--- a/editor/libeditor/html/tests/test_bug674770-1.html
+++ b/editor/libeditor/html/tests/test_bug674770-1.html
@@ -17,17 +17,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a href="file_bug674770-1.html" id="link1">test</a>
 <div contenteditable>
 <a href="file_bug674770-1.html" id="link2">test</a>
 </div>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") != 0) {
+if (!navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 674770 **/
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(function() {
   SpecialPowers.setBoolPref("middlemouse.paste", true);
   localStorage.removeItem("clicked");
--- a/editor/libeditor/text/tests/test_bug638596.html
+++ b/editor/libeditor/text/tests/test_bug638596.html
@@ -13,17 +13,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=638596">Mozilla Bug 638596</a>
 <p id="display"></p>
 <div id="content">
   <input type="password" style="font-size: 0">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 /** Test for Bug 638596 **/
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(function() {
   var i = document.querySelector("input");
   i.focus();
--- a/js/xpconnect/tests/mochitest/test_bug393269.html
+++ b/js/xpconnect/tests/mochitest/test_bug393269.html
@@ -9,17 +9,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <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=393269">Mozilla Bug 393269</a>
 <iframe id="ifr"></iframe>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(1, 2);
 } else {
   SimpleTest.expectAssertions(2);
 }
 
 (function () {
     /** Test for Bug 393269 **/
     var doc = $("ifr").contentDocument;
--- a/layout/base/tests/chrome/test_printpreview.xul
+++ b/layout/base/tests/chrome/test_printpreview.xul
@@ -5,15 +5,15 @@
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 <body xmlns="http://www.w3.org/1999/xhtml">
 </body>
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 SimpleTest.waitForExplicitFinish();
 window.open("printpreview_helper.xul", "printpreview", "chrome,width=100,height=100");
 ]]></script>
 </window>
--- a/layout/base/tests/chrome/test_printpreview_bug396024.xul
+++ b/layout/base/tests/chrome/test_printpreview_bug396024.xul
@@ -11,15 +11,15 @@ https://bugzilla.mozilla.org/show_bug.cg
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 <body xmlns="http://www.w3.org/1999/xhtml">
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=396024"
    target="_blank">Mozilla Bug 396024</a>
 </body>
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 SimpleTest.waitForExplicitFinish();
 window.open("printpreview_bug396024_helper.xul", "bug396024", "chrome,width=100,height=100");
 ]]></script>
 </window>
--- a/layout/base/tests/chrome/test_transformed_scrolling_repaints.html
+++ b/layout/base/tests/chrome/test_transformed_scrolling_repaints.html
@@ -10,17 +10,17 @@
 <body onload="setTimeout(startTest,0)">
 <div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
   <div style="height:40px;">Hello</div>
   <div id="e" style="height:30px; background:lime">Kitty</div>
   <div style="height:300px; background:yellow">Kitty</div>
 </div>
 <pre id="test">
 <script type="application/javascript">
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 SimpleTest.waitForExplicitFinish();
 
 var t = document.getElementById("t");
 var e = document.getElementById("e");
 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                getInterface(Components.interfaces.nsIDOMWindowUtils);
--- a/layout/base/tests/test_bug93077-6.html
+++ b/layout/base/tests/test_bug93077-6.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
 <p id="display"></p>
 <div id=filler>...</div>
 <p id=below></p>
 <p><a name=TOP>Top</a></p>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 /** Test for Bug 93077 **/
 ["#top", "#Top"].forEach(function(fragid) {
   document.getElementById("below").scrollIntoView()
   isnot(window.scrollY, 0)
   location.hash = fragid
--- a/layout/base/tests/test_image_layers.html
+++ b/layout/base/tests/test_image_layers.html
@@ -6,17 +6,17 @@
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body onload="changeImage()">
 <div>
 <img id="image" src="./image_rgrg-256x256.png" style="-moz-transform: translatex(1px)"></img>
 </div>
 <pre id="test">
 <script type="application/javascript">
-if (navigator.platform.indexOf("Linux") != 0) {
+if (!navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var image = document.getElementById("image");
 var lastPaintCount;
 
--- a/layout/base/tests/test_mozPaintCount.html
+++ b/layout/base/tests/test_mozPaintCount.html
@@ -11,17 +11,17 @@
        drawmode="solid" color="FF00FF00"></embed>
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var startPaintCount = window.mozPaintCount;
 ok(true, "Got to initial paint count: " + startPaintCount);
 var color = 0;
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -9,17 +9,17 @@
   <style>
     iframe {
       width: 600px;
       height: 600px;
     }
   </style>
 <script type="text/javascript">
 
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var canvases = [];
 function callbackTestCanvas(canvas)
 {
--- a/layout/base/tests/test_scroll_selection_into_view.html
+++ b/layout/base/tests/test_scroll_selection_into_view.html
@@ -62,17 +62,17 @@
     <div style="height:800px;"></div>
   </div>
   <div style="height:800px;"></div>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 var ANCHOR = 0;
 var FOCUS = 1;
 
 function testCollapsed(id, vPercent, startAt, expected) {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
--- a/layout/forms/test/test_bug536567_perwindowpb.html
+++ b/layout/forms/test/test_bug536567_perwindowpb.html
@@ -10,17 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=536567">Mozilla Bug 536567</a>
 <p id="display"></p>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Mac") != 0) {
+if (!navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 4);
 }
 
 /** Test for Bug 536567 **/
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
--- a/layout/forms/test/test_bug665540.html
+++ b/layout/forms/test/test_bug665540.html
@@ -13,17 +13,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=665540">Mozilla Bug 665540</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 /** Test for Bug 665540 **/
 
 SimpleTest.waitForExplicitFinish();
 
 var win;
--- a/layout/generic/test/test_bug469613.xul
+++ b/layout/generic/test/test_bug469613.xul
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </body>
 
 <vbox style="height: 100px; overflow: auto;" id="scrollbox">
   <hbox style="height: 200px;"/>
 </vbox>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 /** Test for Bug 469613 **/
 
 function doTest() {
   let scrollbox = document.getElementById("scrollbox");
   scrollbox.scrollTop = 0;
--- a/layout/generic/test/test_bug469774.xul
+++ b/layout/generic/test/test_bug469774.xul
@@ -22,17 +22,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 /** Test for Bug 469774 **/
 
 // Test whether menu popups are blocked from being painted in their parent window.
 
 // Like snapshotWindow, but with DRAWWINDOW_DRAW_CARET
--- a/layout/generic/test/test_bug508115.xul
+++ b/layout/generic/test/test_bug508115.xul
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body  xmlns="http://www.w3.org/1999/xhtml">
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=508115">Mozilla Bug 508115</a>
 
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 <script class="testbody" type="application/javascript"><![CDATA[
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 function doTest() {
   document.getElementById("panel").style.display = '';
   document.getElementById("deck").selectedIndex = 1;
   document.getElementById("anchor").open = true;
   document.getElementById("container").style.width = "0";
--- a/layout/generic/test/test_bug514732-2.xul
+++ b/layout/generic/test/test_bug514732-2.xul
@@ -25,17 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 /** Test for Bug 514732 **/
 
 SimpleTest.waitForExplicitFinish();
 window.open("file_bug514732_window.xul", "bug514732",
             "chrome,width=600,height=600,scrollbars");
--- a/layout/generic/test/test_bug632379.xul
+++ b/layout/generic/test/test_bug632379.xul
@@ -161,17 +161,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 </body>
 
 
 <script class="testbody" type="application/javascript"><![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 /** Test for Bug 632379 **/
 // Tests whether scrolling a menu affects the position at which popups appear
 var pos = new Array(2);
 var count=0;
 
--- a/layout/generic/test/test_selection_underline.html
+++ b/layout/generic/test/test_selection_underline.html
@@ -3,19 +3,19 @@
 <head>
   <title>Test for selection underline</title>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 3);
-} else if (navigator.platform.indexOf("Linux") == 0) {
+} else if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 // Canvas related code stolen from layout/base/tests/bidi_numeral_test.js which
 // stole from http://developer.mozilla.org/en/docs/Code_snippets:Canvas
 
 var RemoteCanvas = function(aIFrame, aTest) {
   this.iframe = aIFrame;
--- a/layout/style/test/test_pointer-events.html
+++ b/layout/style/test/test_pointer-events.html
@@ -45,17 +45,17 @@
     iframe.contentDocument.writeln("<"+"/script>");
     iframe.contentDocument.close();
   </script>
 
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.8">
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 } else {
   SimpleTest.expectAssertions(1);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function catches_pointer_events(element_id)
--- a/security/manager/ssl/tests/mochitest/mixedcontent/test_cssContent2.html
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/test_cssContent2.html
@@ -7,17 +7,17 @@
   <script type="text/javascript" src="/MochiKit/Style.js"></script>
   <script type="text/javascript" src="/MochiKit/Signal.js"></script>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="mixedContentTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
   <script class="testbody" type="text/javascript">
 
-  if (navigator.platform.indexOf("Mac") == 0) {
+  if (navigator.platform.startsWith("Mac")) {
     SimpleTest.expectAssertions(0, 1);
   }
 
   function runTest()
   {
     isSecurityState("secure");
     document.getElementById("para").style.content =
       "url('http://example.com/tests/security/ssl/mixedcontent/moonsurface.jpg')";
--- a/toolkit/content/tests/chrome/test_bug437844.xul
+++ b/toolkit/content/tests/chrome/test_bug437844.xul
@@ -34,17 +34,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     </div>
     <pre id="test">
     </pre>
   </body>
 
   <script class="testbody" type="application/javascript">
     <![CDATA[
 
-      if (navigator.platform.indexOf("Linux") == 0) {
+      if (navigator.platform.startsWith("Linux")) {
         SimpleTest.expectAssertions(5, 6);
       } else {
         SimpleTest.expectAssertions(4);
       }
 
       /** Test for Bug 437844 and Bug 348233 **/
       SimpleTest.waitForExplicitFinish();
 
--- a/toolkit/content/tests/chrome/test_bug509732.xul
+++ b/toolkit/content/tests/chrome/test_bug509732.xul
@@ -12,17 +12,17 @@
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
         onload="test()"/>
 
   <!-- test code goes here -->
 <script type="application/javascript">
 <![CDATA[
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 5);
 }
 
 var gNotificationBox;
 
 // Tests that a notification that is added in an hidden box didn't throw the animation
 function test() {
   SimpleTest.waitForExplicitFinish();
--- a/toolkit/content/tests/chrome/test_bug557987.xul
+++ b/toolkit/content/tests/chrome/test_bug557987.xul
@@ -17,17 +17,17 @@
   <menulist id="menulist" editable="true" value="Test bug 557987" 
                                           onfocus="eventReceived('focus')" />
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 SimpleTest.waitForFocus(test);
 
 // Tests that mouse events are correctly dispatched to <toolbarbutton type="menu-button"/>
--- a/toolkit/content/tests/chrome/test_bug562554.xul
+++ b/toolkit/content/tests/chrome/test_bug562554.xul
@@ -21,17 +21,17 @@
   </toolbarbutton>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(test);
 
 // Tests that mouse events are correctly dispatched to <toolbarbutton type="menu"/>
 function test() {
--- a/toolkit/content/tests/chrome/test_bug570192.xul
+++ b/toolkit/content/tests/chrome/test_bug570192.xul
@@ -30,19 +30,19 @@ https://bugzilla.mozilla.org/show_bug.cg
     </div>
     <pre id="test">
     </pre>
   </body>
 
   <script type="application/javascript">
     <![CDATA[
 
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(0, 2);
-    } else if (navigator.platform.indexOf("Linux") == 0) {
+    } else if (navigator.platform.startsWith("Linux")) {
       SimpleTest.expectAssertions(0, 5);
     }
 
     addLoadEvent(function() {
       try {
         var content = document.getElementById("content");
         content.innerHTML = '<textbox newlines="pasteintact" ' +
           'xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"/>';
--- a/toolkit/content/tests/chrome/test_bug585946.xul
+++ b/toolkit/content/tests/chrome/test_bug585946.xul
@@ -18,17 +18,17 @@
 
   <!-- test resuls are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml"
         style="height: 300px; overflow: auto;"/>
   
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function startTest() {
   var toolbar = $("toolbar");
 
--- a/toolkit/content/tests/chrome/test_bug624329.xul
+++ b/toolkit/content/tests/chrome/test_bug624329.xul
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
      target="_blank">Mozilla Bug 624329</a>
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
   /** Test for Bug 624329 **/
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var win;
 var timeoutID;
 var menu;
--- a/toolkit/content/tests/chrome/test_bug792324.xul
+++ b/toolkit/content/tests/chrome/test_bug792324.xul
@@ -33,17 +33,17 @@ https://bugzilla.mozilla.org/show_bug.cg
           accesskey="X"
           oncommand="clicked(event)"
           label="Button in panel 2"
   />
 </panel>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 /** Test for Bug 792324 **/
 let after_click;
 
 function clicked(event) {
   after_click(event);
--- a/toolkit/content/tests/chrome/test_button.xul
+++ b/toolkit/content/tests/chrome/test_button.xul
@@ -23,17 +23,17 @@
 </hbox>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
 <script type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 } else {
   SimpleTest.expectAssertions(0, 5);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function test_button()
--- a/toolkit/content/tests/chrome/test_chromemargin.xul
+++ b/toolkit/content/tests/chrome/test_chromemargin.xul
@@ -12,17 +12,17 @@
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
 <script>
 
 // Tests parsing of the chrome margin attrib on a window.
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 SimpleTest.waitForExplicitFinish();
 function runTest()
 {
   window.open("window_chromemargin.xul", "_blank", "chrome,width=600,height=600");
 }
--- a/toolkit/content/tests/chrome/test_closemenu_attribute.xul
+++ b/toolkit/content/tests/chrome/test_closemenu_attribute.xul
@@ -23,19 +23,19 @@
       </menupopup>
     </menu>
   </menupopup>
 </button>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 3);
-} else if (navigator.platform.indexOf("Linux") == 0) {
+} else if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 5);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var gExpectedId = "p3";
 var gMode = -1;
 var gModes = ["", "auto", "single", "none"];
--- a/toolkit/content/tests/chrome/test_colorpicker_popup.xul
+++ b/toolkit/content/tests/chrome/test_colorpicker_popup.xul
@@ -16,19 +16,19 @@
 <colorpicker id="colorpicker-popup" type="button" color="#FF0000" tabindex="1"/>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
 var gTestPhase = -1;
 var gCp = null;
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 4);
-} else if (navigator.platform.indexOf("Linux") == 0) {
+} else if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 5);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function preventDefault(event) {
   event.preventDefault();
 }
--- a/toolkit/content/tests/chrome/test_contextmenu_list.xul
+++ b/toolkit/content/tests/chrome/test_contextmenu_list.xul
@@ -68,17 +68,17 @@
 <menupopup id="themenu" onpopupshowing="if (gTestId == -1) event.preventDefault()"
                         onpopupshown="checkPopup()" onpopuphidden="setTimeout(nextTest, 0);">
   <menuitem label="Item"/>
 </menupopup>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 5);
 } else {
   SimpleTest.expectAssertions(0, 7);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var gTestId = -1;
--- a/toolkit/content/tests/chrome/test_datepicker.xul
+++ b/toolkit/content/tests/chrome/test_datepicker.xul
@@ -32,17 +32,17 @@
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script>
 <![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 5);
 }
 
 var mouseScrolled = false;
 
 SimpleTest.waitForExplicitFinish();
 
 function testtag_datepickers()
--- a/toolkit/content/tests/chrome/test_deck.xul
+++ b/toolkit/content/tests/chrome/test_deck.xul
@@ -22,17 +22,17 @@
 </deck>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 4);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function test_deck()
 {
   var deck = $("deck1");
--- a/toolkit/content/tests/chrome/test_dialogfocus.xul
+++ b/toolkit/content/tests/chrome/test_dialogfocus.xul
@@ -18,17 +18,17 @@
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script>
 <![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 4);
 } else {
   SimpleTest.expectAssertions(0, 5);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var expected = [ "one", "_extra2", "tab", "one", "tabbutton2", "tabbutton", "two", "textbox-yes", "one" ];
--- a/toolkit/content/tests/chrome/test_findbar_events.xul
+++ b/toolkit/content/tests/chrome/test_findbar_events.xul
@@ -25,17 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     </div>
     <pre id="test">
     </pre>
   </body>
 
   <script class="testbody" type="application/javascript">
     <![CDATA[
 
-      if (navigator.platform.indexOf("Mac") == 0) {
+      if (navigator.platform.startsWith("Mac")) {
         SimpleTest.expectAssertions(0, 4);
       }
 
       /** Test for Bug 793275 **/
       SimpleTest.waitForExplicitFinish();
       window.open("findbar_events_window.xul", "793275test",
                   "chrome,width=600,height=600");
 
--- a/toolkit/content/tests/chrome/test_focus_anons.xul
+++ b/toolkit/content/tests/chrome/test_focus_anons.xul
@@ -19,19 +19,19 @@
   </menupopup>
 </menulist>
 <textbox id="textbox"/>
 <scale id="scale"/>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 4);
-} else if (navigator.platform.indexOf("Mac") == 0) {
+} else if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var gBlurs = 0, gFocuses = 0;
 var gExpectedBlur = "";
 var gExpectedFocus = "";
--- a/toolkit/content/tests/chrome/test_hiddenitems.xul
+++ b/toolkit/content/tests/chrome/test_hiddenitems.xul
@@ -33,17 +33,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     <listitem id="listbox_item5" label="Item 5" collapsed="true"/>
     <listitem id="listbox_item6" label="Item 6"/>
     <listitem id="listbox_item7" label="Item 7" hidden="true"/>
   </listbox>
   
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 /** Test for Bug 317422 **/
 SimpleTest.waitForExplicitFinish();
 
 function testListbox(id)
 {
--- a/toolkit/content/tests/chrome/test_hiddenpaging.xul
+++ b/toolkit/content/tests/chrome/test_hiddenpaging.xul
@@ -59,17 +59,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     <listitem id="listbox_item13" label="Item 13"/>
     <listitem id="listbox_item14" label="Item 14"/>
     <listitem id="listbox_item15" label="Item 15" hidden="true"/>
   </listbox>
   
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 /** Test for Bug 317422 **/
 SimpleTest.waitForExplicitFinish();
 
 function testRichlistbox()
 {
--- a/toolkit/content/tests/chrome/test_keys.xul
+++ b/toolkit/content/tests/chrome/test_keys.xul
@@ -5,17 +5,17 @@
 <window title="Keys Test"
   onload="setTimeout(runTest, 0);"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
 <script>
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 SimpleTest.waitForExplicitFinish();
 function runTest()
 {
   window.open("window_keys.xul", "_blank", "chrome,width=200,height=200");
 }
 </script>
--- a/toolkit/content/tests/chrome/test_largemenu.xul
+++ b/toolkit/content/tests/chrome/test_largemenu.xul
@@ -7,17 +7,17 @@
   xmlns:html="http://www.w3.org/1999/xhtml"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <title>Large Menu Tests</title>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
 <script>
-if (navigator.platform.indexOf("Win") != 0) {
+if (!navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 3);
 }
 
 SimpleTest.waitForExplicitFinish();
 function runTest()
 {
   window.open("window_largemenu.xul", "_blank", "chrome,width=200,height=200");
 }
--- a/toolkit/content/tests/chrome/test_menu.xul
+++ b/toolkit/content/tests/chrome/test_menu.xul
@@ -22,17 +22,17 @@
         </menu>
       </menupopup>
     </menu>
   </menubar>
 
   <script class="testbody" type="application/javascript">
   <![CDATA[
 
-  if (navigator.platform.indexOf("Mac") == 0) {
+  if (navigator.platform.startsWith("Mac")) {
     SimpleTest.expectAssertions(0, 2);
   }
 
   SimpleTest.waitForExplicitFinish();
 
   function runTests()
   {
     var menu = document.getElementById("nested");
--- a/toolkit/content/tests/chrome/test_menuchecks.xul
+++ b/toolkit/content/tests/chrome/test_menuchecks.xul
@@ -31,17 +31,17 @@
   </hbox>
 
   <!--
   This test checks that checkbox and radio menu items work properly
   -->
   <script class="testbody" type="application/javascript">
   <![CDATA[
 
-  if (navigator.platform.indexOf("Mac") == 0) {
+  if (navigator.platform.startsWith("Mac")) {
     SimpleTest.expectAssertions(0, 2);
   }
 
   SimpleTest.waitForExplicitFinish();
   var gTestIndex = 0;
 
   // tests to perform
   var tests = [
--- a/toolkit/content/tests/chrome/test_menuitem_blink.xul
+++ b/toolkit/content/tests/chrome/test_menuitem_blink.xul
@@ -11,17 +11,17 @@
   <menulist id="menulist">
     <menupopup id="menupopup">
       <menuitem label="Menu Item" id="menuitem"/>
     </menupopup>
   </menulist>
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(startTest);
 
 function startTest() {
   if (!/Mac/.test(navigator.platform)) {
--- a/toolkit/content/tests/chrome/test_menuitem_commands.xul
+++ b/toolkit/content/tests/chrome/test_menuitem_commands.xul
@@ -6,17 +6,17 @@
         onload="runOrOpen()"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
 <script>
 <![CDATA[
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 function checkAttributes(elem, label, accesskey, disabled, hidden, isAfter)
 {
   var is = window.opener.wrappedJSObject.SimpleTest.is;
--- a/toolkit/content/tests/chrome/test_menulist_keynav.xul
+++ b/toolkit/content/tests/chrome/test_menulist_keynav.xul
@@ -18,17 +18,17 @@
     <menuitem id="i4" label="Four"/>
   </menupopup>
 </menulist>
 <button id="button2" label="Two"/>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Linux") != 0) {
+if (!navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var gShowPopup = false;
 var gModifiers = 0;
 
--- a/toolkit/content/tests/chrome/test_mousecapture.xul
+++ b/toolkit/content/tests/chrome/test_mousecapture.xul
@@ -6,17 +6,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
 
 <script>
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(6);
 } else {
   SimpleTest.expectAssertions(6, 8);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var captureRetargetMode = false;
--- a/toolkit/content/tests/chrome/test_notificationbox.xul
+++ b/toolkit/content/tests/chrome/test_notificationbox.xul
@@ -13,17 +13,17 @@
     <menuitem label="One"/>
   </menupopup>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
 
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(0, 3);
 } else {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 var testtag_notificationbox_buttons = [
--- a/toolkit/content/tests/chrome/test_panel.xul
+++ b/toolkit/content/tests/chrome/test_panel.xul
@@ -7,17 +7,17 @@
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
 
 <script>
-if (navigator.platform.indexOf("Mac") == 0) {
+if (navigator.platform.startsWith("Mac")) {
   SimpleTest.expectAssertions(0, 2);
 }
 
 SimpleTest.waitForExplicitFinish();
 function runTest()
 {
   window.open("window_panel.xul", "_blank", "chrome,left=200,top=200,width=200,height=200");
 }
--- a/toolkit/content/tests/chrome/test_preferences.xul
+++ b/toolkit/content/tests/chrome/test_preferences.xul
@@ -7,17 +7,17 @@
         onload="RunTest();">
   <title>Preferences Window Tests</title>
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
   <script type="application/javascript">
   <![CDATA[
-    if (navigator.platform.indexOf("Mac") == 0) {
+    if (navigator.platform.startsWith("Mac")) {
       SimpleTest.expectAssertions(4);
     }
     SimpleTest.waitForExplicitFinish();
 
     const kPref = Components.classes["@mozilla.org/preferences-service;1"]
                             .getService(Components.interfaces.nsIPrefBranch);
 
     // preference values, set 1
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_412360.xul
@@ -17,17 +17,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 let didFail = false;
 var file;
 
--- a/toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_bug_462172.xul
@@ -27,17 +27,17 @@ close window
           src="utils.js"/>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
   /** Test for Bug 462172 **/
 var missingFileElid;
 var realFileElid;
 const kFiller = "notApplicable";
 const kFillerURL = "https://bugzilla.mozilla.org/show_bug.cgi?id=462172"
--- a/toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_cleanup_search.xul
@@ -17,17 +17,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
     todo(false, "skip test for toolkit download manager UI");
--- a/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_close_on_last_window.xul
@@ -18,17 +18,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(2);
 }
 
 const DLMGR_UI_DONE = "download-manager-ui-done";
 
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 let gGen, dm, dmui, chromeWindow, testCleanup;
--- a/toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_multiword_search.xul
@@ -15,17 +15,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1, 2);
 }
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
     todo(false, "skip test for toolkit download manager UI");
--- a/toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_search_clearlist.xul
@@ -14,17 +14,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
     todo(false, "skip test for toolkit download manager UI");
--- a/toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_search_keys.xul
@@ -17,17 +17,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 function test_meta_k(aWin)
 {
   let doc = aWin.document;
   let searchbox = doc.getElementById("searchbox");
   let richlistbox = doc.getElementById("downloadView");
--- a/toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_select_all.xul
@@ -16,17 +16,17 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
   <script type="application/javascript"
           src="utils.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 
-if (navigator.platform.indexOf("Linux") == 0) {
+if (navigator.platform.startsWith("Linux")) {
   SimpleTest.expectAssertions(1);
 }
 
 function test()
 {
   var dmui = getDMUI();
   if (!dmui) {
     todo(false, "skip test for toolkit download manager UI");
--- a/widget/tests/test_bug538242.xul
+++ b/widget/tests/test_bug538242.xul
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 </pre>
 </body>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
-if (navigator.platform.indexOf("Win") == 0) {
+if (navigator.platform.startsWith("Win")) {
   SimpleTest.expectAssertions(0, 1);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 SimpleTest.waitForFocus(function () {
   if (navigator.platform.indexOf("Lin") != -1) {
     ok(true, "This test is disabled on Linux because it expects moving windows to be synchronous which is not guaranteed on Linux.");