Bug 1555786 - Get inner window from doc directly for resize observer. r=smaug
authorBoris Chiou <boris.chiou@gmail.com>
Tue, 25 Jun 2019 20:07:03 +0000
changeset 542941 a3cad1d7836c6f84e33a895841ba0315460115bc
parent 542940 d9fc649ed2007ad35f103dacd7b3b73562c937eb
child 542956 07314de37ce5ffe85657614b2d48e55a02eb5d4d
child 542957 09b3d826af112c35179e87ea0ac804d787cbc2ba
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1555786
milestone69.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 1555786 - Get inner window from doc directly for resize observer. r=smaug In Notify(), we should guarantee that the inner window we get is for the document, and avoid using null outer window pointer. Differential Revision: https://phabricator.services.mozilla.com/D35727
dom/base/ResizeObserverController.cpp
dom/base/crashtests/1555786.html
dom/base/crashtests/crashtests.list
--- a/dom/base/ResizeObserverController.cpp
+++ b/dom/base/ResizeObserverController.cpp
@@ -142,20 +142,17 @@ void ResizeObserverController::Notify() 
 
     init.mMessage.AssignLiteral(
         "ResizeObserver loop completed with undelivered notifications.");
     init.mBubbles = false;
     init.mCancelable = false;
 
     nsEventStatus status = nsEventStatus_eIgnore;
 
-    nsCOMPtr<nsPIDOMWindowInner> window =
-        doc->GetWindow()->GetCurrentInnerWindow();
-
-    if (window) {
+    if (nsCOMPtr<nsPIDOMWindowInner> window = doc->GetInnerWindow()) {
       nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
       MOZ_ASSERT(sgo);
 
       if (NS_WARN_IF(sgo->HandleScriptError(init, &status))) {
         status = nsEventStatus_eIgnore;
       }
     } else {
       // We don't fire error events at any global for non-window JS on the main
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/1555786.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+  <script>
+    function start() {
+      const xhr = new XMLHttpRequest();
+      const observer = new ResizeObserver(entries => {
+        xhr.open('GET', '', false);
+        xhr.send();
+        typeof entries[0].borderBoxSize;
+        typeof entries[0].contentRect;
+        typeof entries[0].borderBoxSize;
+      })
+      observer.observe(document.getElementById('list'), {});
+      window.close();
+    }
+
+    document.addEventListener('DOMContentLoaded', start);
+  </script>
+</head>
+<body>
+  <li class="" id="list">
+</body>
+</html>
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -245,8 +245,9 @@ load 1505875.html
 load 1508845.html
 load 1516289.html
 load 1516560.html
 load 1528675.html
 load structured_clone_container_throws.html
 load xhr_empty_datauri.html
 load xhr_html_nullresponse.html
 load xhr-with-pagehide-1.html
+pref(layout.css.resizeobserver.enabled,true) load 1555786.html