Commit c95721fd authored by kinuko@chromium.org's avatar kinuko@chromium.org

Explicitly reject storage access if requesting security origin is unique

This is a follow-up fix for https://codereview.chromium.org/46583005/
(Send Allow{Database,FileSystem,IndexedDB} sync IPCs
directly from worker threads)

I needed to default behavior to allow storage access when NULL proxy
is returned to make content_shell work, and therefore needed not to
return NULL when origin.isUnique()==true case.

BUG=none
R=jam,michaeln
TBR=jam

Review URL: https://codereview.chromium.org/55433006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232922 0039d316-1c4b-4281-b951-d872f2087c98
parent d756944e
...@@ -13,9 +13,11 @@ namespace content { ...@@ -13,9 +13,11 @@ namespace content {
SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy( SharedWorkerPermissionClientProxy::SharedWorkerPermissionClientProxy(
const GURL& origin_url, const GURL& origin_url,
bool is_unique_origin,
int routing_id, int routing_id,
ThreadSafeSender* thread_safe_sender) ThreadSafeSender* thread_safe_sender)
: origin_url_(origin_url), : origin_url_(origin_url),
is_unique_origin_(is_unique_origin),
routing_id_(routing_id), routing_id_(routing_id),
thread_safe_sender_(thread_safe_sender) { thread_safe_sender_(thread_safe_sender) {
} }
...@@ -27,6 +29,8 @@ bool SharedWorkerPermissionClientProxy::allowDatabase( ...@@ -27,6 +29,8 @@ bool SharedWorkerPermissionClientProxy::allowDatabase(
const WebKit::WebString& name, const WebKit::WebString& name,
const WebKit::WebString& display_name, const WebKit::WebString& display_name,
unsigned long estimated_size) { unsigned long estimated_size) {
if (is_unique_origin_)
return false;
bool result = false; bool result = false;
thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase( thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowDatabase(
routing_id_, origin_url_, name, display_name, routing_id_, origin_url_, name, display_name,
...@@ -35,6 +39,8 @@ bool SharedWorkerPermissionClientProxy::allowDatabase( ...@@ -35,6 +39,8 @@ bool SharedWorkerPermissionClientProxy::allowDatabase(
} }
bool SharedWorkerPermissionClientProxy::allowFileSystem() { bool SharedWorkerPermissionClientProxy::allowFileSystem() {
if (is_unique_origin_)
return false;
bool result = false; bool result = false;
thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowFileSystem( thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowFileSystem(
routing_id_, origin_url_, &result)); routing_id_, origin_url_, &result));
...@@ -43,6 +49,8 @@ bool SharedWorkerPermissionClientProxy::allowFileSystem() { ...@@ -43,6 +49,8 @@ bool SharedWorkerPermissionClientProxy::allowFileSystem() {
bool SharedWorkerPermissionClientProxy::allowIndexedDB( bool SharedWorkerPermissionClientProxy::allowIndexedDB(
const WebKit::WebString& name) { const WebKit::WebString& name) {
if (is_unique_origin_)
return false;
bool result = false; bool result = false;
thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB( thread_safe_sender_->Send(new WorkerProcessHostMsg_AllowIndexedDB(
routing_id_, origin_url_, name, &result)); routing_id_, origin_url_, name, &result));
......
...@@ -21,6 +21,7 @@ class SharedWorkerPermissionClientProxy ...@@ -21,6 +21,7 @@ class SharedWorkerPermissionClientProxy
public: public:
SharedWorkerPermissionClientProxy( SharedWorkerPermissionClientProxy(
const GURL& origin_url, const GURL& origin_url,
bool is_unique_origin,
int routing_id, int routing_id,
ThreadSafeSender* thread_safe_sender); ThreadSafeSender* thread_safe_sender);
virtual ~SharedWorkerPermissionClientProxy(); virtual ~SharedWorkerPermissionClientProxy();
...@@ -34,6 +35,7 @@ class SharedWorkerPermissionClientProxy ...@@ -34,6 +35,7 @@ class SharedWorkerPermissionClientProxy
private: private:
const GURL origin_url_; const GURL origin_url_;
const bool is_unique_origin_;
const int routing_id_; const int routing_id_;
scoped_refptr<ThreadSafeSender> thread_safe_sender_; scoped_refptr<ThreadSafeSender> thread_safe_sender_;
......
...@@ -81,10 +81,8 @@ WebApplicationCacheHost* WebSharedWorkerClientProxy::createApplicationCacheHost( ...@@ -81,10 +81,8 @@ WebApplicationCacheHost* WebSharedWorkerClientProxy::createApplicationCacheHost(
WebKit::WebWorkerPermissionClientProxy* WebKit::WebWorkerPermissionClientProxy*
WebSharedWorkerClientProxy::createWorkerPermissionClientProxy( WebSharedWorkerClientProxy::createWorkerPermissionClientProxy(
const WebKit::WebSecurityOrigin& origin) { const WebKit::WebSecurityOrigin& origin) {
if (origin.isUnique())
return NULL;
return new SharedWorkerPermissionClientProxy( return new SharedWorkerPermissionClientProxy(
GURL(origin.toString()), route_id_, GURL(origin.toString()), origin.isUnique(), route_id_,
ChildThread::current()->thread_safe_sender()); ChildThread::current()->thread_safe_sender());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment