Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Unified Diff: content/child/storage_util.cc

Issue 1810193002: Fix effective Origin URLs for IDB + Cache for file:/// pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factor out origin->GURL conversion helper Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/storage_util.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/storage_util.cc
diff --git a/content/child/storage_util.cc b/content/child/storage_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6e440bf96e82347bfd2a961d01d4fef1fe736ee1
--- /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
« no previous file with comments | « content/child/storage_util.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698