Use allowUniversalAccessFromFileURLs setting for worker
authorJihye Kang <jye.kang@samsung.com>
Wed, 8 May 2013 02:26:47 +0000 (11:26 +0900)
committerJihye Kang <jye.kang@samsung.com>
Wed, 8 May 2013 05:01:08 +0000 (14:01 +0900)
[Title] Use allowUniversalAccessFromFileURLs setting for worker
[Issue#] Orange-232
[Problem] CORS is working differently on Document and worker when it is requested on webapp
[Cause] allowUniversalAccessFromFileURLs is set only on Document
[Solution] Use allowUniversalAccessFromFileURLs for worker

Change-Id: I0538843486655e2386fba5f6608450e158237739

Source/WTF/wtf/Platform.h
Source/WebCore/page/GroupSettings.cpp
Source/WebCore/page/GroupSettings.h
Source/WebCore/workers/WorkerContext.cpp
Source/WebCore/workers/WorkerThread.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 1223d1f..e33de84 100644 (file)
@@ -807,6 +807,10 @@ com) : Patch to do not adjust cover rect as fixed pixel size*/
 #define ENABLE_TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST 1 /* Jihye Kang(jye.kang@samsung.com) : Fix lockup while doing stress test for filewriter */
 
 #define ENABLE_TIZEN_FULLSCREEN_API 1 /* Jongseok Yang(js45.yang@samsung.com) : Implement the smart function for fullscreen API */
+
+#if ENABLE(WORKERS)
+#define ENABLE_TIZEN_WORKERS 1 /* Jihye Kang(jye.kang@samsung.com) : Use allowUniversalAccessFromFileURLs setting for workers */
+#endif
 #endif /* OS(TIZEN) */
 
 /* ==== OS() - underlying operating system; only to be used for mandated low-level services like 
index 7801cfd..2c8ca80 100644 (file)
@@ -34,6 +34,9 @@ GroupSettings::GroupSettings()
 #if ENABLE(TIZEN_FILE_SYSTEM)
     , m_localFileSystemQuotaBytes(0x6400000) // 100M
 #endif
+#if ENABLE(TIZEN_WORKERS)
+    , m_allowUniversalAccessFromFileURLs(false)
+#endif
 {
 }
 
@@ -59,4 +62,11 @@ void GroupSettings::setLocalFileSystemQuotaBytes(int64_t quota)
 }
 #endif
 
+#if ENABLE(TIZEN_WORKERS)
+void GroupSettings::setAllowUniversalAccessFromFileURLs(bool allow)
+{
+    m_allowUniversalAccessFromFileURLs = allow;
+}
+#endif
+
 } // namespace WebCore
index 2f1bcd7..8f22cdd 100644 (file)
@@ -55,6 +55,11 @@ public:
     int64_t localFileSystemQuotaBytes() const { return m_localFileSystemQuotaBytes; }
 #endif
 
+#if ENABLE(TIZEN_WORKERS)
+    void setAllowUniversalAccessFromFileURLs(bool allow);
+    bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; }
+#endif
+
 private:
     GroupSettings();
 
@@ -64,6 +69,9 @@ private:
 #if ENABLE(TIZEN_FILE_SYSTEM)
     int64_t m_localFileSystemQuotaBytes;
 #endif
+#if ENABLE(TIZEN_WORKERS)
+    bool m_allowUniversalAccessFromFileURLs;
+#endif
 };
 
 } // namespace WebCore
index 45e5ebe..81108c7 100644 (file)
@@ -98,6 +98,10 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPt
     , m_eventQueue(WorkerEventQueue::create(this))
 {
     setSecurityOrigin(SecurityOrigin::create(url));
+#if ENABLE(TIZEN_WORKERS)
+    if (securityOrigin()->isLocal() && m_groupSettings->allowUniversalAccessFromFileURLs())
+        securityOrigin()->grantUniversalAccess();
+#endif
     setContentSecurityPolicy(ContentSecurityPolicy::create(this));
     contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType);
 }
index 3b90ea2..a1a68d1 100644 (file)
@@ -105,6 +105,9 @@ WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const St
 #if ENABLE(TIZEN_FILE_SYSTEM)
     m_groupSettings->setLocalFileSystemQuotaBytes(settings->localFileSystemQuotaBytes());
 #endif
+#if ENABLE(TIZEN_WORKERS)
+    m_groupSettings->setAllowUniversalAccessFromFileURLs(settings->allowUniversalAccessFromFileURLs());
+#endif
 
 }
 
index 3e89f24..5cebbba 100755 (executable)
@@ -2467,6 +2467,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     m_page->group().groupSettings()->setLocalFileSystemQuotaBytes(0x6400000); //100M
 #endif
 
+#if ENABLE(TIZEN_WORKERS)
+    m_page->group().groupSettings()->setAllowUniversalAccessFromFileURLs(settings->allowUniversalAccessFromFileURLs());
+#endif
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)