Bug 926452 - The call to getComputedStyle in the onStateChange progress listener of BrowserElementChildPreload.js is expensive (~30ms). r=fabrice
authorVivien Nicolas <vnicolas@mozilla.com>
Thu, 15 Oct 2015 06:40:00 +0200
changeset 268745 b0359c684793d8361829a92d81b65fffed4f2934
parent 268744 0bcf20224e95720428f13ad5454747313dab0c7f
child 268746 2e52638cab7c5162aea16066d0942776c0b4d7d5
push id29562
push userkwierso@gmail.com
push dateWed, 21 Oct 2015 23:29:46 +0000
treeherdermozilla-central@4879f22ef96a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs926452
milestone44.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 926452 - The call to getComputedStyle in the onStateChange progress listener of BrowserElementChildPreload.js is expensive (~30ms). r=fabrice
dom/browser-element/BrowserElementChildPreload.js
dom/browser-element/mochitest/browserElement_LoadEvents.js
dom/browser-element/mochitest/file_browserElement_LoadEvents.html
dom/browser-element/mochitest/mochitest.ini
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -1891,22 +1891,17 @@ BrowserElementChild.prototype = {
       }
 
       if (stateFlags & Ci.nsIWebProgressListener.STATE_START) {
         this._seenLoadStart = true;
         sendAsyncMsg('loadstart');
       }
 
       if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
-        let bgColor = 'transparent';
-        try {
-          bgColor = content.getComputedStyle(content.document.body)
-                           .getPropertyValue('background-color');
-        } catch (e) {}
-        sendAsyncMsg('loadend', {backgroundColor: bgColor});
+        sendAsyncMsg('loadend');
 
         switch (status) {
           case Cr.NS_OK :
           case Cr.NS_BINDING_ABORTED :
             // Ignoring NS_BINDING_ABORTED, which is set when loading page is
             // stopped.
             return;
 
--- a/dom/browser-element/mochitest/browserElement_LoadEvents.js
+++ b/dom/browser-element/mochitest/browserElement_LoadEvents.js
@@ -17,17 +17,17 @@ function runTest() {
 
   var seenLoadEnd = false;
   var seenLoadStart = false;
   var seenLocationChange = false;
 
   var iframe = document.createElement('iframe');
   iframe.setAttribute('mozbrowser', 'true');
   iframe.id = 'iframe';
-  iframe.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_LoadEvents.html';
+  iframe.src = browserElementTestHelpers.emptyPage1;
 
   function loadstart(e) {
     ok(e.isTrusted, 'Event should be trusted.');
     ok(!seenLoadEnd, 'loadstart before loadend.');
     ok(!seenLoadStart, 'Just one loadstart event.');
     ok(!seenLocationChange, 'loadstart before locationchange.');
     seenLoadStart = true;
   }
@@ -41,17 +41,16 @@ function runTest() {
     ok(e.detail, browserElementTestHelpers.emptyPage1, "event's reported location");
   }
 
   function loadend(e) {
     ok(e.isTrusted, 'Event should be trusted.');
     ok(seenLoadStart, 'loadend after loadstart.');
     ok(!seenLoadEnd, 'Just one loadend event.');
     ok(seenLocationChange, 'loadend after locationchange.');
-    is(e.detail.backgroundColor, 'rgb(0, 128, 0)', 'Expected background color reported')
     seenLoadEnd = true;
   }
 
   iframe.addEventListener('mozbrowserloadstart', loadstart);
   iframe.addEventListener('mozbrowserlocationchange', locationchange);
   iframe.addEventListener('mozbrowserloadend', loadend);
 
   function waitForAllCallbacks() {
@@ -95,17 +94,16 @@ function runTest2() {
   });
 
   iframe.addEventListener('mozbrowserloadend', function(e) {
     ok(e.isTrusted, 'Event should be trusted.');
     ok(!seenLoadEnd, 'Just one load end event.');
     seenLoadEnd = true;
     ok(seenLoadStart, 'Load end after load start.');
     ok(seenLocationChange, 'Load end after location change.');
-    is(e.detail.backgroundColor, 'transparent', 'Expected background color reported')
   });
 
   iframe.src = browserElementTestHelpers.emptyPage2;
 
   function waitForAllCallbacks() {
     if (!seenLoadStart || !seenLoadEnd || !seenLocationChange) {
       SimpleTest.executeSoon(waitForAllCallbacks);
       return;
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_browserElement_LoadEvents.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<html>
-<body style="background-color:green;">
-
-<!-- Tests rely on the fact that there's an element in here called 'url' and
-     that there's visible text on the page. -->
-
-Aloha!  My URL is <span id='url'></span>.
-
-<script>
-document.getElementById('url').innerHTML = window.location;
-</script>
-
-</body>
-</html>
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -90,17 +90,16 @@ support-files =
   file_browserElement_BrowserWindowNamespace.html
   file_browserElement_CloseApp.html
   file_browserElement_CloseFromOpener.html
   file_browserElement_CookiesNotThirdParty.html
   file_browserElement_DisallowEmbedAppsInOOP.html
   file_browserElement_ExecuteScript.html
   file_browserElement_ForwardName.html
   file_browserElement_FrameWrongURI.html
-  file_browserElement_LoadEvents.html
   file_browserElement_Metachange.sjs
   file_browserElement_NextPaint.html
   file_browserElement_Open1.html
   file_browserElement_Open2.html
   file_browserElement_OpenNamed.html
   file_browserElement_OpenNamed2.html
   file_browserElement_OpenWindowDifferentOrigin.html
   file_browserElement_OpenWindowInFrame.html