summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/SecurityOrigin.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/page/SecurityOrigin.h')
-rw-r--r--Source/WebCore/page/SecurityOrigin.h51
1 files changed, 22 insertions, 29 deletions
diff --git a/Source/WebCore/page/SecurityOrigin.h b/Source/WebCore/page/SecurityOrigin.h
index f1108d512..d11866de0 100644
--- a/Source/WebCore/page/SecurityOrigin.h
+++ b/Source/WebCore/page/SecurityOrigin.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -50,17 +50,12 @@ public:
BlockAllStorage
};
- WEBCORE_EXPORT static Ref<SecurityOrigin> create(const URL&);
- static Ref<SecurityOrigin> createUnique();
+ static PassRefPtr<SecurityOrigin> create(const URL&);
+ static PassRefPtr<SecurityOrigin> createUnique();
- WEBCORE_EXPORT static Ref<SecurityOrigin> createFromDatabaseIdentifier(const String&);
- // Alternate form of createFromDatabaseIdentifier that returns a nullptr on failure, instead of an empty origin.
- // FIXME: Many users of createFromDatabaseIdentifier seem to expect maybeCreateFromDatabaseIdentifier behavior,
- // but they aren't getting it so they might be buggy.
- WEBCORE_EXPORT static RefPtr<SecurityOrigin> maybeCreateFromDatabaseIdentifier(const String&);
-
- WEBCORE_EXPORT static Ref<SecurityOrigin> createFromString(const String&);
- WEBCORE_EXPORT static Ref<SecurityOrigin> create(const String& protocol, const String& host, int port);
+ static PassRefPtr<SecurityOrigin> createFromDatabaseIdentifier(const String&);
+ static PassRefPtr<SecurityOrigin> createFromString(const String&);
+ static PassRefPtr<SecurityOrigin> create(const String& protocol, const String& host, int port);
// Some URL schemes use nested URLs for their security context. For example,
// filesystem URLs look like the following:
@@ -77,7 +72,7 @@ public:
// Create a deep copy of this SecurityOrigin. This method is useful
// when marshalling a SecurityOrigin to another thread.
- WEBCORE_EXPORT Ref<SecurityOrigin> isolatedCopy() const;
+ PassRefPtr<SecurityOrigin> isolatedCopy() const;
// Set the domain property of this security origin to newDomain. This
// function does not check whether newDomain is a suffix of the current
@@ -99,7 +94,7 @@ public:
// SecurityOrigin. For example, call this function before allowing
// script from one security origin to read or write objects from
// another SecurityOrigin.
- WEBCORE_EXPORT bool canAccess(const SecurityOrigin*) const;
+ bool canAccess(const SecurityOrigin*) const;
// Returns true if this SecurityOrigin can read content retrieved from
// the given URL. For example, call this function before issuing
@@ -119,7 +114,7 @@ public:
// Returns true if |document| can display content from the given URL (e.g.,
// in an iframe or as an image). For example, web sites generally cannot
// display content from the user's files system.
- WEBCORE_EXPORT bool canDisplay(const URL&) const;
+ bool canDisplay(const URL&) const;
// Returns true if this SecurityOrigin can load local resources, such
// as images, iframes, and style sheets, and can link to local URLs.
@@ -147,22 +142,24 @@ public:
void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; }
#if ENABLE(CACHE_PARTITIONING)
- WEBCORE_EXPORT String domainForCachePartition() const;
+ String cachePartition() const;
#endif
- bool canAccessDatabase(const SecurityOrigin* topOrigin = nullptr) const { return canAccessStorage(topOrigin); };
+ bool canAccessDatabase(const SecurityOrigin* topOrigin = 0) const { return canAccessStorage(topOrigin); };
bool canAccessSessionStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin, AlwaysAllowFromThirdParty); }
bool canAccessLocalStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); };
+ bool canAccessSharedWorkers(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
bool canAccessPluginStorage(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
bool canAccessApplicationCache(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
bool canAccessCookies() const { return !isUnique(); }
- bool canRequestGeolocation() const { return !isUnique(); }
+ bool canAccessPasswordManager() const { return !isUnique(); }
+ bool canAccessFileSystem() const { return !isUnique(); }
Policy canShowNotifications() const;
// The local SecurityOrigin is the most privileged SecurityOrigin.
// The local SecurityOrigin can script any document, navigate to local
// resources, and can set arbitrary headers on XMLHttpRequests.
- WEBCORE_EXPORT bool isLocal() const;
+ bool isLocal() const;
// The origin is a globally unique identifier assigned when the Document is
// created. http://www.whatwg.org/specs/web-apps/current-work/#sandboxOrigin
@@ -187,28 +184,28 @@ public:
// this SecurityOrigin might have come from a sandboxed iframe, the
// SecurityOrigin might be empty, or we might have explicitly decided that
// we shouldTreatURLSchemeAsNoAccess.
- WEBCORE_EXPORT String toString() const;
+ String toString() const;
// Similar to toString(), but does not take into account any factors that
// could make the string return "null".
- WEBCORE_EXPORT String toRawString() const;
+ String toRawString() const;
// Serialize the security origin to a string that could be used as part of
// file names. This format should be used in storage APIs only.
- WEBCORE_EXPORT String databaseIdentifier() const;
+ String databaseIdentifier() const;
// This method checks for equality between SecurityOrigins, not whether
// one origin can access another. It is used for hash table keys.
// For access checks, use canAccess().
// FIXME: If this method is really only useful for hash table keys, it
// should be refactored into SecurityOriginHash.
- WEBCORE_EXPORT bool equal(const SecurityOrigin*) const;
+ bool equal(const SecurityOrigin*) const;
// This method checks for equality, ignoring the value of document.domain
// (and whether it was set) but considering the host. It is used for postMessage.
- WEBCORE_EXPORT bool isSameSchemeHostPort(const SecurityOrigin*) const;
+ bool isSameSchemeHostPort(const SecurityOrigin*) const;
- static URL urlWithUniqueSecurityOrigin();
+ static String urlWithUniqueSecurityOrigin();
private:
SecurityOrigin();
@@ -218,13 +215,9 @@ private:
// FIXME: Rename this function to something more semantic.
bool passesFileCheck(const SecurityOrigin*) const;
bool isThirdParty(const SecurityOrigin*) const;
-
- // This method checks that the scheme for this origin is an HTTP-family
- // scheme, e.g. HTTP and HTTPS.
- bool isHTTPFamily() const { return m_protocol == "http" || m_protocol == "https"; }
enum ShouldAllowFromThirdParty { AlwaysAllowFromThirdParty, MaybeAllowFromThirdParty };
- WEBCORE_EXPORT bool canAccessStorage(const SecurityOrigin*, ShouldAllowFromThirdParty = MaybeAllowFromThirdParty) const;
+ bool canAccessStorage(const SecurityOrigin*, ShouldAllowFromThirdParty = MaybeAllowFromThirdParty) const;
String m_protocol;
String m_host;