Title: [224502] trunk/Source/WebCore
Revision
224502
Author
[email protected]
Date
2017-11-06 11:46:35 -0800 (Mon, 06 Nov 2017)

Log Message

ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
https://bugs.webkit.org/show_bug.cgi?id=179322

Reviewed by Sam Weinig.

ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
unnecessarily.

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::serviceWorkerContainer):
* page/DOMWindow.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224501 => 224502)


--- trunk/Source/WebCore/ChangeLog	2017-11-06 19:29:40 UTC (rev 224501)
+++ trunk/Source/WebCore/ChangeLog	2017-11-06 19:46:35 UTC (rev 224502)
@@ -1,3 +1,17 @@
+2017-11-06  Chris Dumez  <[email protected]>
+
+        ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
+        https://bugs.webkit.org/show_bug.cgi?id=179322
+
+        Reviewed by Sam Weinig.
+
+        ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
+        unnecessarily.
+
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::serviceWorkerContainer):
+        * page/DOMWindow.h:
+
 2017-11-06  Colin Bendell  <[email protected]>
 
         Added mime type check to the picture source preloader to avoid downloading incompatible resources.

Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (224501 => 224502)


--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2017-11-06 19:29:40 UTC (rev 224501)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp	2017-11-06 19:46:35 UTC (rev 224502)
@@ -545,9 +545,9 @@
     NavigatorBase* navigator = nullptr;
     if (is<Document>(*this)) {
         if (auto* window = downcast<Document>(*this).domWindow())
-            navigator = window->navigator();
+            navigator = window->optionalNavigator();
     } else
-        navigator = &downcast<WorkerGlobalScope>(*this).navigator();
+        navigator = downcast<WorkerGlobalScope>(*this).optionalNavigator();
 
     return navigator ? navigator->serviceWorker() : nullptr;
 }

Modified: trunk/Source/WebCore/page/DOMWindow.h (224501 => 224502)


--- trunk/Source/WebCore/page/DOMWindow.h	2017-11-06 19:29:40 UTC (rev 224501)
+++ trunk/Source/WebCore/page/DOMWindow.h	2017-11-06 19:46:35 UTC (rev 224502)
@@ -137,6 +137,7 @@
     BarProp* statusbar() const;
     BarProp* toolbar() const;
     Navigator* navigator() const;
+    Navigator* optionalNavigator() const { return m_navigator.get(); }
     Navigator* clientInformation() const { return navigator(); }
 
     Location* location() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to