Title: [141466] trunk/Source
Revision
141466
Author
[email protected]
Date
2013-01-31 12:48:49 -0800 (Thu, 31 Jan 2013)

Log Message

Cleanup: Use ScriptExecutionContext::topOrigin when relevant.
https://bugs.webkit.org/show_bug.cgi?id=108476

Source/WebCore:

Reviewed by Jochen Eisinger.

Rather than diving through 'frame()->top()' or 'topDocument()' to get
the SecurityOrigin of the top-level document in a frame, we can now
directly grab the 'topOrigin()' off of a ScriptExecutionContext. This
patch adjusts a few callsites to use the new hotness rather than the
old brokenness.

This is a pure refactoring: No web-visible changes should result.

* Modules/webdatabase/DOMWindowWebDatabase.cpp:
(WebCore::DOMWindowWebDatabase::openDatabase):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::sessionStorage):
(WebCore::DOMWindow::localStorage):
* workers/SharedWorker.cpp:
(WebCore::SharedWorker::create):
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerContext):

Source/WebKit2:

Reviewed by Anders Carlsson.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::storageBlockingStateChanged):
(WebKit::PluginView::isPrivateBrowsingEnabled):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141465 => 141466)


--- trunk/Source/WebCore/ChangeLog	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebCore/ChangeLog	2013-01-31 20:48:49 UTC (rev 141466)
@@ -1,3 +1,28 @@
+2013-01-31  Mike West  <[email protected]>
+
+        Cleanup: Use ScriptExecutionContext::topOrigin when relevant.
+        https://bugs.webkit.org/show_bug.cgi?id=108476
+
+        Reviewed by Jochen Eisinger.
+
+        Rather than diving through 'frame()->top()' or 'topDocument()' to get
+        the SecurityOrigin of the top-level document in a frame, we can now
+        directly grab the 'topOrigin()' off of a ScriptExecutionContext. This
+        patch adjusts a few callsites to use the new hotness rather than the
+        old brokenness.
+
+        This is a pure refactoring: No web-visible changes should result.
+
+        * Modules/webdatabase/DOMWindowWebDatabase.cpp:
+        (WebCore::DOMWindowWebDatabase::openDatabase):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::sessionStorage):
+        (WebCore::DOMWindow::localStorage):
+        * workers/SharedWorker.cpp:
+        (WebCore::SharedWorker::create):
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerMessagingProxy::startWorkerContext):
+
 2013-01-31  [email protected]  <[email protected]>
 
         [Curl] There is no way for a WebKit client to set the Curl cookie jar path

Modified: trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp (141465 => 141466)


--- trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp	2013-01-31 20:48:49 UTC (rev 141466)
@@ -47,7 +47,7 @@
 
     RefPtr<Database> database = 0;
     DatabaseManager& dbManager = DatabaseManager::manager();
-    if (dbManager.isAvailable() && window->document()->securityOrigin()->canAccessDatabase(window->document()->topDocument()->securityOrigin()))
+    if (dbManager.isAvailable() && window->document()->securityOrigin()->canAccessDatabase(window->document()->topOrigin()))
         database = dbManager.openDatabase(window->document(), name, version, displayName, estimatedSize, creationCallback, ec);
 
     if (!database && !ec)

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (141465 => 141466)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2013-01-31 20:48:49 UTC (rev 141466)
@@ -740,7 +740,7 @@
     if (!document)
         return 0;
 
-    if (!document->securityOrigin()->canAccessLocalStorage(document->topDocument()->securityOrigin())) {
+    if (!document->securityOrigin()->canAccessLocalStorage(document->topOrigin())) {
         ec = SECURITY_ERR;
         return 0;
     }
@@ -777,7 +777,7 @@
     if (!document)
         return 0;
 
-    if (!document->securityOrigin()->canAccessLocalStorage(document->topDocument()->securityOrigin())) {
+    if (!document->securityOrigin()->canAccessLocalStorage(document->topOrigin())) {
         ec = SECURITY_ERR;
         return 0;
     }

Modified: trunk/Source/WebCore/workers/SharedWorker.cpp (141465 => 141466)


--- trunk/Source/WebCore/workers/SharedWorker.cpp	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebCore/workers/SharedWorker.cpp	2013-01-31 20:48:49 UTC (rev 141466)
@@ -72,7 +72,7 @@
     // We don't currently support nested workers, so workers can only be created from documents.
     ASSERT(context->isDocument());
     Document* document = static_cast<Document*>(context);
-    if (!document->securityOrigin()->canAccessSharedWorkers(document->topDocument()->securityOrigin())) {
+    if (!document->securityOrigin()->canAccessSharedWorkers(document->topOrigin())) {
         ec = SECURITY_ERR;
         return 0;
     }

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (141465 => 141466)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2013-01-31 20:48:49 UTC (rev 141466)
@@ -279,10 +279,7 @@
     GroupSettings* settings = 0;
     if (document->page())
         settings = document->page()->group().groupSettings();
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode,
-                                                                         document->contentSecurityPolicy()->deprecatedHeader(),
-                                                                         document->contentSecurityPolicy()->deprecatedHeaderType(),
-                                                                         document->topDocument()->securityOrigin());
+    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, userAgent, settings, sourceCode, *this, *this, startMode, document->contentSecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderType(), document->topOrigin());
     workerThreadCreated(thread);
     thread->start();
     InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get(), this, scriptURL);

Modified: trunk/Source/WebKit2/ChangeLog (141465 => 141466)


--- trunk/Source/WebKit2/ChangeLog	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-31 20:48:49 UTC (rev 141466)
@@ -1,3 +1,14 @@
+2013-01-31  Mike West  <[email protected]>
+
+        Cleanup: Use ScriptExecutionContext::topOrigin when relevant.
+        https://bugs.webkit.org/show_bug.cgi?id=108476
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::storageBlockingStateChanged):
+        (WebKit::PluginView::isPrivateBrowsingEnabled):
+
 2013-01-31  Anders Carlsson  <[email protected]>
 
         Get rid of IncomingMessage

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (141465 => 141466)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-01-31 20:47:12 UTC (rev 141465)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-01-31 20:48:49 UTC (rev 141466)
@@ -634,7 +634,7 @@
     if (!m_isInitialized || !m_plugin)
         return;
 
-    bool storageBlockingPolicy = !frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->tree()->top()->document()->securityOrigin());
+    bool storageBlockingPolicy = !frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->document()->topOrigin());
 
     m_plugin->storageBlockingStateChanged(storageBlockingPolicy);
 }
@@ -1440,7 +1440,7 @@
     if (!frame())
         return true;
 
-    if (!frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->tree()->top()->document()->securityOrigin()))
+    if (!frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->document()->topOrigin()))
         return true;
 
     Settings* settings = frame()->settings();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to