Bug 1010473: Talos: Fix Profiler.js for stand-alone cases (TART/tscroll). r=jmaher
authorAvi Halachmi <avihpit@yahoo.com>
Thu, 15 May 2014 17:18:43 +0300
changeset 754 c4f3254f6d1ab4a213db39af0f4cb03081bc4e10
parent 753 53c8b1ad4828bba2566a4ef651f9ea8b3cc565fe
child 755 43cb79ca8df3dbff6c17c8ea52896c3eb89c63b9
push id483
push userahalachmi@mozilla.com
push dateThu, 15 May 2014 14:26:24 +0000
reviewersjmaher
bugs1010473
Bug 1010473: Talos: Fix Profiler.js for stand-alone cases (TART/tscroll). r=jmaher
talos/page_load_test/tart/addon/content/Profiler.js
talos/pageloader/chrome/Profiler.js
talos/scripts/Profiler.js
--- a/talos/page_load_test/tart/addon/content/Profiler.js
+++ b/talos/page_load_test/tart/addon/content/Profiler.js
@@ -1,21 +1,38 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// - NOTE: This file is duplicated verbatim at:
+//         - talos/scripts/Profiler.js
+//         - talos/pageloader/chrome/Profiler.js
+//         - talos/page_load_test/tart/addon/content/Profiler.js
+//
+//  - Please keep these copies in sync.
+//  - Please make sure your changes apply cleanly to all use cases.
+
 // Finer grained profiler control
 //
 // Use this object to pause and resume the profiler so that it only profiles the
 // relevant parts of our tests.
-var Profiler;
+var Profiler = { // Initialize as placeholder, replace with actual if available.
+  resume: function() {},
+  pause:  function() {},
+  mark:   function() {}
+};
+
 (function(){
   var _profiler;
   var test_name = document.location.pathname;
 
   try {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     _profiler = Components.classes["@mozilla.org/tools/profiler;1"].getService(Components.interfaces.nsIProfiler);
-  } catch (ex) { dumpLog(ex + "\n"); }
+  } catch (ex) { (typeof(dumpLog) == "undefined" ? dump : dumpLog)(ex + "\n"); }
 
   Profiler = {
     resume: function Profiler__resume (name) {
       if (_profiler) {
         if (_profiler.ResumeSampling) {
           _profiler.ResumeSampling();
         }
         _profiler.AddMarker('Start of test "' + (name || test_name) + '"');
--- a/talos/pageloader/chrome/Profiler.js
+++ b/talos/pageloader/chrome/Profiler.js
@@ -1,21 +1,38 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// - NOTE: This file is duplicated verbatim at:
+//         - talos/scripts/Profiler.js
+//         - talos/pageloader/chrome/Profiler.js
+//         - talos/page_load_test/tart/addon/content/Profiler.js
+//
+//  - Please keep these copies in sync.
+//  - Please make sure your changes apply cleanly to all use cases.
+
 // Finer grained profiler control
 //
 // Use this object to pause and resume the profiler so that it only profiles the
 // relevant parts of our tests.
-var Profiler;
+var Profiler = { // Initialize as placeholder, replace with actual if available.
+  resume: function() {},
+  pause:  function() {},
+  mark:   function() {}
+};
+
 (function(){
   var _profiler;
   var test_name = document.location.pathname;
 
   try {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     _profiler = Components.classes["@mozilla.org/tools/profiler;1"].getService(Components.interfaces.nsIProfiler);
-  } catch (ex) { dumpLog(ex + "\n"); }
+  } catch (ex) { (typeof(dumpLog) == "undefined" ? dump : dumpLog)(ex + "\n"); }
 
   Profiler = {
     resume: function Profiler__resume (name) {
       if (_profiler) {
         if (_profiler.ResumeSampling) {
           _profiler.ResumeSampling();
         }
         _profiler.AddMarker('Start of test "' + (name || test_name) + '"');
--- a/talos/scripts/Profiler.js
+++ b/talos/scripts/Profiler.js
@@ -1,21 +1,38 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// - NOTE: This file is duplicated verbatim at:
+//         - talos/scripts/Profiler.js
+//         - talos/pageloader/chrome/Profiler.js
+//         - talos/page_load_test/tart/addon/content/Profiler.js
+//
+//  - Please keep these copies in sync.
+//  - Please make sure your changes apply cleanly to all use cases.
+
 // Finer grained profiler control
 //
 // Use this object to pause and resume the profiler so that it only profiles the
 // relevant parts of our tests.
-var Profiler;
+var Profiler = { // Initialize as placeholder, replace with actual if available.
+  resume: function() {},
+  pause:  function() {},
+  mark:   function() {}
+};
+
 (function(){
   var _profiler;
   var test_name = document.location.pathname;
 
   try {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
     _profiler = Components.classes["@mozilla.org/tools/profiler;1"].getService(Components.interfaces.nsIProfiler);
-  } catch (ex) { dumpLog(ex + "\n"); }
+  } catch (ex) { (typeof(dumpLog) == "undefined" ? dump : dumpLog)(ex + "\n"); }
 
   Profiler = {
     resume: function Profiler__resume (name) {
       if (_profiler) {
         if (_profiler.ResumeSampling) {
           _profiler.ResumeSampling();
         }
         _profiler.AddMarker('Start of test "' + (name || test_name) + '"');