[Webkit-unassigned] [Bug 36595] Forward DatabaseTracker::canEstablishDatabase to chromium layer.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 25 07:07:39 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=36595





--- Comment #3 from Jeremy Orlow <jorlow at chromium.org>  2010-03-25 07:07:38 PST ---
(From update of attachment 51633)
r+ from me, but leaving it r? for now to give some others a chance to chime in.

> diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h
> index c6f51b6..5ffc2e3 100644
> --- a/WebKit/chromium/public/WebFrameClient.h
> +++ b/WebKit/chromium/public/WebFrameClient.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2009 Google Inc. All rights reserved.
> + * Copyright (C) 2010 Google Inc. All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions are
> @@ -263,6 +263,9 @@ public:
>      // Controls whether scripts are allowed to execute for this frame.
>      virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
>  
> +    // Controls whether access to Web Databases is allowed for this frame.
> +    virtual bool allowDatabase(const WebSecurityOrigin&, const WebString&, const WebString&, unsigned long) { return true; }

If anything, I'd probably default this to false...but do what you think is
best.

> +
>      // Notifies the client that the frame would have executed script if script were enabled.
>      virtual void didNotAllowScript(WebFrame*) { }
>  
> diff --git a/WebKit/chromium/src/DatabaseObserver.cpp b/WebKit/chromium/src/DatabaseObserver.cpp
> index 54e93e1..1f13351 100644
> --- a/WebKit/chromium/src/DatabaseObserver.cpp
> +++ b/WebKit/chromium/src/DatabaseObserver.cpp
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2009 Google Inc. All rights reserved.
> + * Copyright (C) 2010 Google Inc. All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions are
> @@ -32,13 +32,37 @@
>  #include "DatabaseObserver.h"
>  
>  #include "Database.h"
> +#include "Document.h"
> +#include "ScriptExecutionContext.h"
>  #include "WebDatabase.h"
>  #include "WebDatabaseObserver.h"
> +#include "WebFrameClient.h"
> +#include "WebFrameImpl.h"
> +#include "WebSecurityOrigin.h"
> +#include "WebWorkerImpl.h"
> +#include "WorkerContext.h"
> +#include "WorkerThread.h"
>  
>  using namespace WebKit;
>  
>  namespace WebCore {
>  
> +bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize)
> +{
> +    ASSERT(isMainThread());
> +    ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerContext());
> +    if (scriptExecutionContext->isDocument()) {
> +        Document* document = static_cast<Document*>(scriptExecutionContext);
> +        WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
> +        return webFrame->client()->allowDatabase(WebSecurityOrigin(scriptExecutionContext->securityOrigin()), name, displayName, estimatedSize);
> +    } else {
> +        WorkerContext* worker = static_cast<WorkerContext*>(scriptExecutionContext);
> +        WorkerLoaderProxy* workerLoaderProxy = &worker->thread()->workerLoaderProxy();
> +        WebWorkerImpl* webWorker = reinterpret_cast<WebWorkerImpl*>(workerLoaderProxy);
> +        return webWorker->allowDatabase(WebSecurityOrigin(scriptExecutionContext->securityOrigin()), name, displayName, estimatedSize);
> +    }

I don't know for sure whether this is the proper way to do this.  Seems
plausible tho.

> +}
> +
>  void DatabaseObserver::databaseOpened(Database* database)
>  {
>      ASSERT(isMainThread());
> diff --git a/WebKit/chromium/src/WebWorkerBase.h b/WebKit/chromium/src/WebWorkerBase.h
> index 0217401..c50d4a3 100644
> --- a/WebKit/chromium/src/WebWorkerBase.h
> +++ b/WebKit/chromium/src/WebWorkerBase.h
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2009 Google Inc. All rights reserved.
> + * Copyright (C) 2010 Google Inc. All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions are
> @@ -45,8 +45,11 @@ class WorkerThread;
>  
>  namespace WebKit {
>  class WebCommonWorkerClient;
> +class WebSecurityOrigin;
> +class WebString;
>  class WebURL;
>  class WebView;
> +class WebWorker;
>  class WebWorkerClient;
>  
>  // Base class for WebSharedWorkerImpl and WebWorkerImpl. It contains common
> @@ -77,6 +80,9 @@ public:
>      virtual void postTaskForModeToWorkerContext(
>          PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode);
>  
> +    // Controls whether access to Web Databases is allowed for this worker.
> +    virtual bool allowDatabase(const WebSecurityOrigin&, const WebString&, const WebString&, unsigned long) { return true; }

If anything, I'd probably default this to false...but do what you think is
best.

> +
>      // Executes the given task on the main thread.
>      static void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>);
>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list