WebCore: SharedWorkers need to support loading.
authorDrew Wilson <atwilson@chromium.org>
Wed, 19 Aug 2009 00:04:04 +0000 (00:04 +0000)
committerDrew Wilson <atwilson@chromium.org>
Wed, 19 Aug 2009 00:04:04 +0000 (00:04 +0000)
commit965749cbeae8d7f2f110768d0a73dab2a0e1231d
treecfa21c8e520bc09759d2f773310bf93361fece7b
parent29d5c239122ada9c67fc4dfe0fc43c057206cefe
WebCore: SharedWorkers need to support loading.
https://bugs.webkit.org/show_bug.cgi?id=28342

Reviewed by David Levin.

Added loader support to shared workers, and refactored worker tests to also test SharedWorkers

* workers/DefaultSharedWorkerRepository.cpp:
(WebCore::SharedWorkerProxy::postTaskToLoader):
Forwards load requests to an arbitrary document from the list of worker's documents.
(WebCore::SharedWorkerProxy::postTaskForModeToWorkerContext):
Posts responses back to the shared worker thread.

LayoutTests: SharedWorkers need to support loading
https://bugs.webkit.org/show_bug.cgi?id=28342

Reviewed by David Levin.

Refactored worker network tests to also test SharedWorkers.

* http/tests/workers/resources/worker-importScripts.js:
Refactored to run in either a dedicated or shared worker.
(handleConnect.self.postMessage):
(handleConnect):
(runTests.try.resetLoadFlags):
(runTests):
* http/tests/workers/resources/worker-redirect-target.js:
Refactored to run in either a dedicated or shared worker.
(else.self.onconnect):
* http/tests/workers/resources/worker-redirect.js: Added.
Moved test code out of worker-redirect.html so it can be shared with shared worker tests.
(log):
(runNextTest):
(testCrossOriginLoad.try.worker.onerror):
(testCrossOriginLoad.try.worker.onmessage):
(testCrossOriginLoad):
(testCrossOriginRedirectedLoad.try.worker.onerror):
(testCrossOriginRedirectedLoad.try.worker.onmessage):
(testCrossOriginRedirectedLoad):
* http/tests/workers/shared-worker-importScripts-expected.txt: Added.
* http/tests/workers/shared-worker-importScripts.html-disabled: Added.
* http/tests/workers/shared-worker-redirect-expected.txt: Added
* http/tests/workers/shared-worker-redirect.html-disabled: Added.
* http/tests/workers/worker-redirect.html:
Moved test code into worker-redirect.js.
* http/tests/xmlhttprequest/workers/close.html:
Moved test code into close-test.js.
* http/tests/xmlhttprequest/workers/methods-async.html:
Moved test code into methods-async-test.js.
* http/tests/xmlhttprequest/workers/methods.html:
Moved test code into methods.js.
* http/tests/xmlhttprequest/workers/resources/close-test.js: Added.
Contains test code moved from close.html, so tests can be shared with SharedWorkers.
(log):
(testAsync.worker.onmessage.else):
(testAsync.worker.onmessage):
(testAsync):
(testSync.worker.onmessage.else):
(testSync.worker.onmessage):
(testSync):
(done):
(handleException):
* http/tests/xmlhttprequest/workers/resources/close.js:
Modified worker code so it runs in shared workers also.
* http/tests/xmlhttprequest/workers/resources/file-not-found.js: Added.
Contains test code moved from xmlhttprequest-file-not-found.html (now shared with shared worker tests).
(log):
(worker.onmessage):
* http/tests/xmlhttprequest/workers/resources/methods-async-test.js: Added.
Contains test code moved from methods-async.html (now shared with shared worker tests).
(log):
(worker.onmessage):
* http/tests/xmlhttprequest/workers/resources/methods-async.js:
Changed code to run in shared workers also.
* http/tests/xmlhttprequest/workers/resources/methods-test.js: Added.
Contains test code moved from methods.html (now shared with shared worker tests).
(log):
(worker.onmessage):
* http/tests/xmlhttprequest/workers/resources/methods.js:
Now can run in either dedicated or shared workers.
(init):
* http/tests/xmlhttprequest/workers/resources/shared-worker-create.js: Added.
Utility code to allow shared workers to look like dedicated workers to enable sharing test code.
(createWorker.worker.port.onmessage):
(createWorker.worker.postMessage):
(createWorker):
* http/tests/xmlhttprequest/workers/resources/worker-create.js: Added.
(createWorker):
* http/tests/xmlhttprequest/workers/resources/worker-pre.js: Added.
Utility code to make SharedWorkerGlobalScope look like DedicatedWorkerGlobalScope, to enable test code sharing.
(else.self.onconnect.self.postMessage):
(else.self.onconnect.event.messagePort.onmessage):
(else.self.onconnect):
* http/tests/xmlhttprequest/workers/resources/xmlhttprequest-file-not-found.js:
(init):
Updated code so it runs in shared workers also.
* http/tests/xmlhttprequest/workers/shared-worker-close-expected.txt: Added.
* http/tests/xmlhttprequest/workers/shared-worker-close.html-disabled: Added.
* http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Added.
* http/tests/xmlhttprequest/workers/shared-worker-methods-async.html-disabled: Added.
* http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Added.
* http/tests/xmlhttprequest/workers/shared-worker-methods.html-disabled: Added.
* http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found-expected.txt: Added.
* http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found.html-disabled: Added.
* http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html:
Moved test code into file-not-found.js.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47467 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/resources/worker-importScripts.js
LayoutTests/http/tests/workers/resources/worker-redirect-target.js
LayoutTests/http/tests/workers/resources/worker-redirect.js [new file with mode: 0644]
LayoutTests/http/tests/workers/shared-worker-importScripts-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/shared-worker-importScripts.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/workers/shared-worker-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/shared-worker-redirect.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/workers/worker-redirect.html
LayoutTests/http/tests/xmlhttprequest/workers/close.html
LayoutTests/http/tests/xmlhttprequest/workers/methods-async.html
LayoutTests/http/tests/xmlhttprequest/workers/methods.html
LayoutTests/http/tests/xmlhttprequest/workers/resources/close-test.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/close.js
LayoutTests/http/tests/xmlhttprequest/workers/resources/file-not-found.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/methods-async-test.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/methods-async.js
LayoutTests/http/tests/xmlhttprequest/workers/resources/methods-test.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/methods.js
LayoutTests/http/tests/xmlhttprequest/workers/resources/shared-worker-create.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/worker-create.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/worker-pre.js [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/resources/xmlhttprequest-file-not-found.js
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-close-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-close.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-methods-async.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-methods.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/shared-worker-xhr-file-not-found.html-disabled [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html
WebCore/ChangeLog
WebCore/workers/DefaultSharedWorkerRepository.cpp