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

Unified Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 2714813003: Add an identity component for unique/opaque url::Origins.
Patch Set: Switch to base::UnguessableToken, add to SecurityOrigin. No conversions yet. Created 3 years, 10 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
Index: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
index d7c0ccb1c6342a0800288451fa01992ed5f4c2aa..f32b4f960f33ae02a0145b2b122959cfba922934 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -151,6 +151,7 @@ SecurityOrigin::SecurityOrigin()
: m_protocol(emptyString),
m_host(emptyString),
m_domain(emptyString),
+ m_uniqueID(base::UnguessableToken::Create()),
m_port(InvalidPort),
m_effectivePort(InvalidPort),
m_isUnique(true),
@@ -165,6 +166,7 @@ SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
m_host(other->m_host.isolatedCopy()),
m_domain(other->m_domain.isolatedCopy()),
m_suborigin(other->m_suborigin),
+ m_uniqueID(other->m_uniqueID),
m_port(other->m_port),
m_effectivePort(other->m_effectivePort),
m_isUnique(other->m_isUnique),
@@ -228,8 +230,10 @@ bool SecurityOrigin::canAccess(const SecurityOrigin* other) const {
if (this == other)
return true;
- if (isUnique() || other->isUnique())
- return false;
+ if (isUnique() || other->isUnique()) {
+ return isUnique() && other->isUnique() ? m_uniqueID == other->m_uniqueID
+ : false;
+ }
// document.domain handling, as per
// https://html.spec.whatwg.org/multipage/browsers.html#dom-document-domain:
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/SecurityOrigin.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698