summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/child/indexed_db/webidbfactory_impl.cc11
-rw-r--r--content/child/storage_util.cc26
-rw-r--r--content/child/storage_util.h24
-rw-r--r--content/content_child.gypi10
-rw-r--r--content/renderer/renderer_blink_platform_impl.cc6
5 files changed, 65 insertions, 12 deletions
diff --git a/content/child/indexed_db/webidbfactory_impl.cc b/content/child/indexed_db/webidbfactory_impl.cc
index fcb6312..770f132 100644
--- a/content/child/indexed_db/webidbfactory_impl.cc
+++ b/content/child/indexed_db/webidbfactory_impl.cc
@@ -5,8 +5,8 @@
#include "content/child/indexed_db/webidbfactory_impl.h"
#include "content/child/indexed_db/indexed_db_dispatcher.h"
+#include "content/child/storage_util.h"
#include "content/child/thread_safe_sender.h"
-#include "third_party/WebKit/public/platform/URLConversion.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -28,7 +28,7 @@ void WebIDBFactoryImpl::getDatabaseNames(WebIDBCallbacks* callbacks,
IndexedDBDispatcher* dispatcher =
IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
dispatcher->RequestIDBFactoryGetDatabaseNames(
- callbacks, blink::WebStringToGURL(origin.toString()));
+ callbacks, WebSecurityOriginToGURL(origin));
}
void WebIDBFactoryImpl::open(const WebString& name,
@@ -39,9 +39,10 @@ void WebIDBFactoryImpl::open(const WebString& name,
const WebSecurityOrigin& origin) {
IndexedDBDispatcher* dispatcher =
IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
+
dispatcher->RequestIDBFactoryOpen(name, version, transaction_id, callbacks,
database_callbacks,
- blink::WebStringToGURL(origin.toString()));
+ WebSecurityOriginToGURL(origin));
}
void WebIDBFactoryImpl::deleteDatabase(const WebString& name,
@@ -49,8 +50,8 @@ void WebIDBFactoryImpl::deleteDatabase(const WebString& name,
const WebSecurityOrigin& origin) {
IndexedDBDispatcher* dispatcher =
IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
- dispatcher->RequestIDBFactoryDeleteDatabase(
- name, callbacks, blink::WebStringToGURL(origin.toString()));
+ dispatcher->RequestIDBFactoryDeleteDatabase(name, callbacks,
+ WebSecurityOriginToGURL(origin));
}
} // namespace content
diff --git a/content/child/storage_util.cc b/content/child/storage_util.cc
new file mode 100644
index 0000000..6e440bf
--- /dev/null
+++ b/content/child/storage_util.cc
@@ -0,0 +1,26 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/storage_util.h"
+
+#include "third_party/WebKit/public/platform/URLConversion.h"
+#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
+#include "url/gurl.h"
+
+namespace content {
+
+GURL WebSecurityOriginToGURL(const blink::WebSecurityOrigin& security_origin) {
+ // "file:///" URLs navigated to by the user may have "isLocal" set,
+ // which stringify as "null" by default. Previous code that sent
+ // origins from Blink to Chromium via DatabaseIdentifier would ignore
+ // this, so we mimic that behavior here.
+ // TODO(jsbell): Eliminate this. https://crbug.com/591482
+ if (security_origin.protocol().utf8() == "file" &&
+ security_origin.host().utf8() == "" && security_origin.port() == 0) {
+ return GURL("file:///");
+ }
+ return blink::WebStringToGURL(security_origin.toString());
+}
+
+} // namespace content
diff --git a/content/child/storage_util.h b/content/child/storage_util.h
new file mode 100644
index 0000000..e6f51a9
--- /dev/null
+++ b/content/child/storage_util.h
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_STORAGE_UTIL_H_
+#define CONTENT_CHILD_STORAGE_UTIL_H_
+
+class GURL;
+
+namespace blink {
+class WebSecurityOrigin;
+} // namespace blink
+
+namespace content {
+
+// Storage APIs rely on GURLs to identify the origin, with some special cases.
+// New uses of this function should be avoided; url::Origin should be used
+// instead.
+// TODO(jsbell): Eliminate this. https://crbug.com/591482
+GURL WebSecurityOriginToGURL(const blink::WebSecurityOrigin& origin);
+
+} // namespace content
+
+#endif // CONTENT_CHILD_STORAGE_UTIL_H_
diff --git a/content/content_child.gypi b/content/content_child.gypi
index 8dee48a1..eb92f42 100644
--- a/content/content_child.gypi
+++ b/content/content_child.gypi
@@ -219,10 +219,6 @@
'child/scoped_child_process_reference.cc',
'child/scoped_child_process_reference.h',
'child/scoped_web_callbacks.h',
- 'child/shared_memory_data_consumer_handle.cc',
- 'child/shared_memory_data_consumer_handle.h',
- 'child/shared_memory_received_data_factory.cc',
- 'child/shared_memory_received_data_factory.h',
'child/service_worker/service_worker_dispatcher.cc',
'child/service_worker/service_worker_dispatcher.h',
'child/service_worker/service_worker_handle_reference.cc',
@@ -241,12 +237,18 @@
'child/service_worker/web_service_worker_provider_impl.h',
'child/service_worker/web_service_worker_registration_impl.cc',
'child/service_worker/web_service_worker_registration_impl.h',
+ 'child/shared_memory_data_consumer_handle.cc',
+ 'child/shared_memory_data_consumer_handle.h',
+ 'child/shared_memory_received_data_factory.cc',
+ 'child/shared_memory_received_data_factory.h',
'child/shared_worker_devtools_agent.cc',
'child/shared_worker_devtools_agent.h',
'child/simple_webmimeregistry_impl.cc',
'child/simple_webmimeregistry_impl.h',
'child/site_isolation_stats_gatherer.cc',
'child/site_isolation_stats_gatherer.h',
+ 'child/storage_util.cc',
+ 'child/storage_util.h',
'child/sync_load_response.cc',
'child/sync_load_response.h',
'child/thread_safe_sender.cc',
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 2de292d..9409b90 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -33,6 +33,7 @@
#include "content/child/quota_dispatcher.h"
#include "content/child/quota_message_filter.h"
#include "content/child/simple_webmimeregistry_impl.h"
+#include "content/child/storage_util.h"
#include "content/child/thread_safe_sender.h"
#include "content/child/web_database_observer_impl.h"
#include "content/child/web_url_loader_impl.h"
@@ -436,9 +437,8 @@ WebIDBFactory* RendererBlinkPlatformImpl::idbFactory() {
blink::WebServiceWorkerCacheStorage* RendererBlinkPlatformImpl::cacheStorage(
const blink::WebSecurityOrigin& security_origin) {
- const GURL origin = blink::WebStringToGURL(security_origin.toString());
- return new WebServiceWorkerCacheStorageImpl(thread_safe_sender_.get(),
- origin);
+ return new WebServiceWorkerCacheStorageImpl(
+ thread_safe_sender_.get(), WebSecurityOriginToGURL(security_origin));
}
//------------------------------------------------------------------------------