summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-25 10:58:37 +0000
committerSteve Block <steveblock@google.com>2010-02-25 11:17:52 +0000
commitcfb0617749a64f2e177386b030d46007b8c4b179 (patch)
tree033b0b4e1b1eaa96831b52fc1ec6675132f33035
parent4175d59b46f96005f0c64978b1a94e3fe60f1e8e (diff)
downloadexternal_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.zip
external_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.tar.gz
external_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.tar.bz2
Adds layout tests for HTML5 features
The following layout tests should all pass on Android, as they are for recently implemented HTML5 features ... - fast/dom/Geolocation - storage - http/tests/appcache This change adds these tests to the Android tree, at the current WebKit revision r54731. This is so that we can easily keep track of which tests should always be green, and so that we can add Android-specific test results. We also add the following paths ... - fast/js/resources - used by the Geolocation tests - http/conf - used by the Appcache tests Tests that are currently failing are added to the DumpRenderTree skipped list temporarily, to keep all tests green. Change-Id: Id96c05e3746ed64e4e4c40c99567b8def688f90a
-rw-r--r--LayoutTests/fast/dom/Geolocation/argument-types-expected.txt82
-rw-r--r--LayoutTests/fast/dom/Geolocation/argument-types.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt13
-rw-r--r--LayoutTests/fast/dom/Geolocation/callback-exception.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/enabled-expected.txt13
-rw-r--r--LayoutTests/fast/dom/Geolocation/enabled.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/error-expected.txt15
-rw-r--r--LayoutTests/fast/dom/Geolocation/error.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt14
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt14
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt14
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt11
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt11
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/permission-denied.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/position-string-expected.txt14
-rw-r--r--LayoutTests/fast/dom/Geolocation/position-string.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt14
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-error.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt16
-rw-r--r--LayoutTests/fast/dom/Geolocation/reentrant-success.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/argument-types.js119
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/callback-exception.js36
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/enabled.js18
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/error.js27
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/js-test-post.js4
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js42
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js38
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js36
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js38
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/permission-denied.js20
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/position-string.js30
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js47
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js52
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/success.js27
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js27
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js21
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/timeout.js29
-rw-r--r--LayoutTests/fast/dom/Geolocation/resources/watch.js65
-rw-r--r--LayoutTests/fast/dom/Geolocation/success-expected.txt12
-rw-r--r--LayoutTests/fast/dom/Geolocation/success.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt11
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-expected.txt12
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt11
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout-zero.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/timeout.html13
-rw-r--r--LayoutTests/fast/dom/Geolocation/watch-expected.txt24
-rw-r--r--LayoutTests/fast/dom/Geolocation/watch.html13
-rw-r--r--LayoutTests/fast/js/resources/JSON-parse.js576
-rw-r--r--LayoutTests/fast/js/resources/JSON-stringify.js508
-rw-r--r--LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js2
-rw-r--r--LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-1.js47
-rw-r--r--LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-2.js43
-rw-r--r--LayoutTests/fast/js/resources/const.js120
-rw-r--r--LayoutTests/fast/js/resources/garbage-collect-after-string-appends.js-disabled39
-rw-r--r--LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js95
-rw-r--r--LayoutTests/fast/js/resources/instanceof-operator-dummy-worker.js1
-rw-r--r--LayoutTests/fast/js/resources/js-test-post-function.js5
-rw-r--r--LayoutTests/fast/js/resources/js-test-post-n.js2
-rw-r--r--LayoutTests/fast/js/resources/js-test-post.js2
-rw-r--r--LayoutTests/fast/js/resources/js-test-pre.js256
-rw-r--r--LayoutTests/fast/js/resources/js-test-style.css12
-rw-r--r--LayoutTests/fast/js/resources/json2-es5-compat.js477
-rw-r--r--LayoutTests/fast/js/resources/lexical-lookup-in-function-constructor-child.html10
-rw-r--r--LayoutTests/fast/js/resources/select-options-remove.js232
-rw-r--r--LayoutTests/fast/js/resources/standalone-post.js2
-rw-r--r--LayoutTests/fast/js/resources/standalone-pre.js141
-rw-r--r--LayoutTests/fast/js/resources/string-concatenate-outofmemory.js52
-rw-r--r--LayoutTests/http/conf/apache2-debian-httpd.conf677
-rw-r--r--LayoutTests/http/conf/apache2-httpd.conf702
-rw-r--r--LayoutTests/http/conf/cygwin-httpd.conf731
-rw-r--r--LayoutTests/http/conf/fedora-httpd.conf882
-rw-r--r--LayoutTests/http/conf/httpd.conf739
-rwxr-xr-xLayoutTests/http/conf/libphp4.dllbin0 -> 3363586 bytes
-rw-r--r--LayoutTests/http/conf/mime.types600
-rw-r--r--LayoutTests/http/conf/webkit-httpd.pem28
-rw-r--r--LayoutTests/http/tests/appcache/404-manifest-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/404-manifest.html59
-rw-r--r--LayoutTests/http/tests/appcache/404-resource-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/404-resource.html39
-rw-r--r--LayoutTests/http/tests/appcache/access-via-redirect-expected.txt3
-rw-r--r--LayoutTests/http/tests/appcache/access-via-redirect.php7
-rw-r--r--LayoutTests/http/tests/appcache/auth-expected.txt5
-rw-r--r--LayoutTests/http/tests/appcache/auth.html28
-rw-r--r--LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back.html27
-rw-r--r--LayoutTests/http/tests/appcache/cyrillic-uri-expected.txt13
-rw-r--r--LayoutTests/http/tests/appcache/cyrillic-uri.html82
-rw-r--r--LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html35
-rw-r--r--LayoutTests/http/tests/appcache/deferred-events-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/deferred-events.html24
-rw-r--r--LayoutTests/http/tests/appcache/destroyed-frame-expected.txt5
-rw-r--r--LayoutTests/http/tests/appcache/destroyed-frame.html52
-rw-r--r--LayoutTests/http/tests/appcache/detached-iframe-expected.txt3
-rw-r--r--LayoutTests/http/tests/appcache/detached-iframe.html15
-rw-r--r--LayoutTests/http/tests/appcache/different-origin-manifest-expected.txt3
-rw-r--r--LayoutTests/http/tests/appcache/different-origin-manifest.html36
-rw-r--r--LayoutTests/http/tests/appcache/different-scheme-expected.txt3
-rw-r--r--LayoutTests/http/tests/appcache/different-scheme.html28
-rw-r--r--LayoutTests/http/tests/appcache/disabled-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/disabled.html51
-rw-r--r--LayoutTests/http/tests/appcache/dynamic-entries-no-cache-expected.txt27
-rw-r--r--LayoutTests/http/tests/appcache/dynamic-entries-no-cache.html-disabled119
-rw-r--r--LayoutTests/http/tests/appcache/empty-manifest-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/empty-manifest.html23
-rw-r--r--LayoutTests/http/tests/appcache/fail-on-update-expected.txt1
-rw-r--r--LayoutTests/http/tests/appcache/fail-on-update.html47
-rw-r--r--LayoutTests/http/tests/appcache/fallback-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/fallback.html171
-rw-r--r--LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt10
-rw-r--r--LayoutTests/http/tests/appcache/foreign-iframe-main.html39
-rw-r--r--LayoutTests/http/tests/appcache/idempotent-update-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/idempotent-update.html56
-rw-r--r--LayoutTests/http/tests/appcache/local-content-expected.txt7
-rw-r--r--LayoutTests/http/tests/appcache/local-content.html51
-rw-r--r--LayoutTests/http/tests/appcache/main-resource-hash-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/main-resource-hash.html51
-rw-r--r--LayoutTests/http/tests/appcache/manifest-containing-itself-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/manifest-containing-itself.html24
-rw-r--r--LayoutTests/http/tests/appcache/manifest-parsing-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/manifest-parsing.html66
-rw-r--r--LayoutTests/http/tests/appcache/manifest-redirect-2-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/manifest-redirect-2.html40
-rw-r--r--LayoutTests/http/tests/appcache/manifest-redirect-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/manifest-redirect.html40
-rw-r--r--LayoutTests/http/tests/appcache/manifest-with-empty-file-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/manifest-with-empty-file.html21
-rw-r--r--LayoutTests/http/tests/appcache/max-size-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/max-size.html28
-rw-r--r--LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress.html21
-rw-r--r--LayoutTests/http/tests/appcache/non-html-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/non-html.xhtml103
-rw-r--r--LayoutTests/http/tests/appcache/offline-access-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/offline-access.html57
-rw-r--r--LayoutTests/http/tests/appcache/online-whitelist-expected.txt4
-rw-r--r--LayoutTests/http/tests/appcache/online-whitelist.html77
-rw-r--r--LayoutTests/http/tests/appcache/reload-expected.txt8
-rw-r--r--LayoutTests/http/tests/appcache/reload.html40
-rw-r--r--LayoutTests/http/tests/appcache/remove-cache-expected.txt10
-rw-r--r--LayoutTests/http/tests/appcache/remove-cache.html111
-rw-r--r--LayoutTests/http/tests/appcache/resource-redirect-2-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/resource-redirect-2.html40
-rw-r--r--LayoutTests/http/tests/appcache/resource-redirect-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/resource-redirect.html40
-rw-r--r--LayoutTests/http/tests/appcache/resources/.htaccess5
-rw-r--r--LayoutTests/http/tests/appcache/resources/404-resource.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/abe.pngbin0 -> 12242 bytes
-rw-r--r--LayoutTests/http/tests/appcache/resources/access-via-redirect.html46
-rw-r--r--LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/auth/iframe.php16
-rw-r--r--LayoutTests/http/tests/appcache/resources/auth/manifest.php12
-rw-r--r--LayoutTests/http/tests/appcache/resources/auth/setup.php10
-rw-r--r--LayoutTests/http/tests/appcache/resources/auth/subresource.php10
-rw-r--r--LayoutTests/http/tests/appcache/resources/counter.php23
-rw-r--r--LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html22
-rw-r--r--LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html28
-rw-r--r--LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest10
-rw-r--r--LayoutTests/http/tests/appcache/resources/different-scheme.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/empty.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/empty.txt0
-rw-r--r--LayoutTests/http/tests/appcache/resources/fail-on-update.php38
-rw-r--r--LayoutTests/http/tests/appcache/resources/fallback-redirect.php8
-rw-r--r--LayoutTests/http/tests/appcache/resources/fallback.manifest5
-rw-r--r--LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js1
-rw-r--r--LayoutTests/http/tests/appcache/resources/foreign-iframe.html4
-rw-r--r--LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest4
-rw-r--r--LayoutTests/http/tests/appcache/resources/idempotent-update.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/intercept/.htaccess2
-rw-r--r--LayoutTests/http/tests/appcache/resources/local-content.manifest4
-rw-r--r--LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html27
-rw-r--r--LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest6
-rw-r--r--LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php7
-rw-r--r--LayoutTests/http/tests/appcache/resources/manifest-redirect.php7
-rw-r--r--LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/maxsize.manifest3
-rw-r--r--LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/non-html.manifest8
-rw-r--r--LayoutTests/http/tests/appcache/resources/not-in-cache.txt1
-rw-r--r--LayoutTests/http/tests/appcache/resources/offline-access-frame.html30
-rw-r--r--LayoutTests/http/tests/appcache/resources/offline-access.js18
-rw-r--r--LayoutTests/http/tests/appcache/resources/offline-access.manifest5
-rw-r--r--LayoutTests/http/tests/appcache/resources/online-whitelist.manifest14
-rw-r--r--LayoutTests/http/tests/appcache/resources/print-uri.php7
-rw-r--r--LayoutTests/http/tests/appcache/resources/reload-iframe.html21
-rw-r--r--LayoutTests/http/tests/appcache/resources/reload-iframe.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html37
-rw-r--r--LayoutTests/http/tests/appcache/resources/remove-cache-frame.html64
-rw-r--r--LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/resource-redirect-2.php7
-rw-r--r--LayoutTests/http/tests/appcache/resources/resource-redirect.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/resource-redirect.php7
-rw-r--r--LayoutTests/http/tests/appcache/resources/simple.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/simple.txt1
-rw-r--r--LayoutTests/http/tests/appcache/resources/slow-resource.php3
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframe-1.html7
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframe-2.html11
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframe-3.html26
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframe-4.html26
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframes-1.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframes-2.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframes-3.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/subframes-4.manifest2
-rw-r--r--LayoutTests/http/tests/appcache/resources/uncacheable-resource.php13
-rw-r--r--LayoutTests/http/tests/appcache/resources/versioned-manifest.php37
-rw-r--r--LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest3
-rw-r--r--LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/wrong-signature.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest1
-rw-r--r--LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html36
-rw-r--r--LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest3
-rw-r--r--LayoutTests/http/tests/appcache/simple-expected.txt2
-rw-r--r--LayoutTests/http/tests/appcache/simple.html55
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-1-expected.txt8
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-1.html38
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-2-expected.txt7
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-2.html42
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-3-expected.txt10
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-3.html60
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-4-expected.txt10
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-4.html60
-rw-r--r--LayoutTests/http/tests/appcache/update-cache-expected.txt10
-rw-r--r--LayoutTests/http/tests/appcache/update-cache.html69
-rw-r--r--LayoutTests/http/tests/appcache/whitelist-wildcard-expected.txt3
-rw-r--r--LayoutTests/http/tests/appcache/whitelist-wildcard.html29
-rw-r--r--LayoutTests/http/tests/appcache/wrong-content-type-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/wrong-content-type.html40
-rw-r--r--LayoutTests/http/tests/appcache/wrong-signature-2-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/wrong-signature-2.html40
-rw-r--r--LayoutTests/http/tests/appcache/wrong-signature-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/wrong-signature.html40
-rw-r--r--LayoutTests/http/tests/appcache/xhr-foreign-resource-expected.txt6
-rw-r--r--LayoutTests/http/tests/appcache/xhr-foreign-resource.html79
-rw-r--r--LayoutTests/storage/change-version-expected.txt4
-rw-r--r--LayoutTests/storage/change-version-handle-reuse-expected.txt6
-rw-r--r--LayoutTests/storage/change-version-handle-reuse.html71
-rw-r--r--LayoutTests/storage/change-version.html90
-rw-r--r--LayoutTests/storage/close-during-stress-test-expected.txt5
-rw-r--r--LayoutTests/storage/close-during-stress-test.html19
-rw-r--r--LayoutTests/storage/database-lock-after-reload-expected.txt3
-rw-r--r--LayoutTests/storage/database-lock-after-reload.html69
-rw-r--r--LayoutTests/storage/domstorage/clear-expected.txt35
-rw-r--r--LayoutTests/storage/domstorage/clear.html12
-rw-r--r--LayoutTests/storage/domstorage/complex-keys-expected.txt237
-rw-r--r--LayoutTests/storage/domstorage/complex-keys.html12
-rw-r--r--LayoutTests/storage/domstorage/complex-values-expected.txt207
-rw-r--r--LayoutTests/storage/domstorage/complex-values.html12
-rw-r--r--LayoutTests/storage/domstorage/events/basic-body-attribute-expected.txt102
-rw-r--r--LayoutTests/storage/domstorage/events/basic-body-attribute.html13
-rw-r--r--LayoutTests/storage/domstorage/events/basic-expected.txt98
-rw-r--r--LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt102
-rw-r--r--LayoutTests/storage/domstorage/events/basic-setattribute.html13
-rw-r--r--LayoutTests/storage/domstorage/events/basic.html13
-rw-r--r--LayoutTests/storage/domstorage/events/case-sensitive-expected.txt38
-rw-r--r--LayoutTests/storage/domstorage/events/case-sensitive.html13
-rw-r--r--LayoutTests/storage/domstorage/events/documentURI-expected.txt40
-rw-r--r--LayoutTests/storage/domstorage/events/documentURI.html13
-rw-r--r--LayoutTests/storage/domstorage/events/resources/body-event-handler.html8
-rw-r--r--LayoutTests/storage/domstorage/events/resources/eventTestHarness.js51
-rw-r--r--LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html11
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html13
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/basic-body-attribute.js98
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js98
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/basic.js97
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/case-sensitive.js50
-rw-r--r--LayoutTests/storage/domstorage/events/script-tests/documentURI.js52
-rw-r--r--LayoutTests/storage/domstorage/localstorage/delete-removal-expected.txt13
-rw-r--r--LayoutTests/storage/domstorage/localstorage/delete-removal.html51
-rw-r--r--LayoutTests/storage/domstorage/localstorage/enumerate-storage-expected.txt9
-rw-r--r--LayoutTests/storage/domstorage/localstorage/enumerate-storage.html47
-rw-r--r--LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key-expected.txt8
-rw-r--r--LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key.html47
-rw-r--r--LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt32
-rw-r--r--LayoutTests/storage/domstorage/localstorage/index-get-and-set.html79
-rw-r--r--LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt7
-rw-r--r--LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage.html50
-rw-r--r--LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js12
-rw-r--r--LayoutTests/storage/domstorage/localstorage/resources/iframe-events-second.html24
-rw-r--r--LayoutTests/storage/domstorage/localstorage/resources/window-open-second.html36
-rw-r--r--LayoutTests/storage/domstorage/localstorage/simple-usage-expected.txt13
-rw-r--r--LayoutTests/storage/domstorage/localstorage/simple-usage.html49
-rw-r--r--LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt15
-rw-r--r--LayoutTests/storage/domstorage/localstorage/string-conversion.html54
-rw-r--r--LayoutTests/storage/domstorage/localstorage/window-open-expected.txt8
-rw-r--r--LayoutTests/storage/domstorage/localstorage/window-open.html39
-rw-r--r--LayoutTests/storage/domstorage/quota-expected.txt32
-rw-r--r--LayoutTests/storage/domstorage/quota.html12
-rw-r--r--LayoutTests/storage/domstorage/remove-item-expected.txt65
-rw-r--r--LayoutTests/storage/domstorage/remove-item.html12
-rw-r--r--LayoutTests/storage/domstorage/script-tests/TEMPLATE.html12
-rw-r--r--LayoutTests/storage/domstorage/script-tests/clear.js34
-rw-r--r--LayoutTests/storage/domstorage/script-tests/complex-keys.js152
-rw-r--r--LayoutTests/storage/domstorage/script-tests/complex-values.js79
-rw-r--r--LayoutTests/storage/domstorage/script-tests/quota.js87
-rw-r--r--LayoutTests/storage/domstorage/script-tests/remove-item.js50
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/delete-removal-expected.txt13
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/delete-removal.html51
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/enumerate-storage-expected.txt9
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/enumerate-storage.html47
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key-expected.txt9
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key.html47
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt32
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html79
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt7
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage.html50
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/resources/clearSessionStorage.js12
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/resources/iframe-events-second.html24
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/resources/window-open-second.html36
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/simple-usage-expected.txt13
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/simple-usage.html49
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt15
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/string-conversion.html54
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/window-open-expected.txt8
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/window-open.html39
-rw-r--r--LayoutTests/storage/domstorage/window-attributes-exist-expected.txt21
-rw-r--r--LayoutTests/storage/domstorage/window-attributes-exist.html59
-rw-r--r--LayoutTests/storage/empty-statement-expected.txt2
-rw-r--r--LayoutTests/storage/empty-statement.html36
-rw-r--r--LayoutTests/storage/execute-sql-args-expected.txt29
-rw-r--r--LayoutTests/storage/execute-sql-args.html109
-rw-r--r--LayoutTests/storage/hash-change-with-xhr-expected.txt3
-rw-r--r--LayoutTests/storage/hash-change-with-xhr.html140
-rw-r--r--LayoutTests/storage/multiple-databases-garbage-collection-expected.txt4
-rw-r--r--LayoutTests/storage/multiple-databases-garbage-collection.html77
-rw-r--r--LayoutTests/storage/multiple-transactions-expected.txt6
-rw-r--r--LayoutTests/storage/multiple-transactions-on-different-handles-expected.txt8
-rw-r--r--LayoutTests/storage/multiple-transactions-on-different-handles.html96
-rw-r--r--LayoutTests/storage/multiple-transactions.html53
-rw-r--r--LayoutTests/storage/open-database-empty-version-expected.txt2
-rw-r--r--LayoutTests/storage/open-database-empty-version.html22
-rw-r--r--LayoutTests/storage/open-database-set-empty-version-expected.txt2
-rw-r--r--LayoutTests/storage/open-database-set-empty-version.html26
-rw-r--r--LayoutTests/storage/open-database-while-transaction-in-progress-expected.txt3
-rw-r--r--LayoutTests/storage/open-database-while-transaction-in-progress.html71
-rw-r--r--LayoutTests/storage/private-browsing-readonly-expected.txt13
-rw-r--r--LayoutTests/storage/private-browsing-readonly.html100
-rw-r--r--LayoutTests/storage/quota-tracking-expected.txt15
-rw-r--r--LayoutTests/storage/quota-tracking.html117
-rw-r--r--LayoutTests/storage/read-and-write-transactions-dont-run-together-expected.txt12
-rw-r--r--LayoutTests/storage/read-and-write-transactions-dont-run-together.html103
-rw-r--r--LayoutTests/storage/read-transactions-running-concurrently-expected.txt3
-rw-r--r--LayoutTests/storage/read-transactions-running-concurrently.html67
-rw-r--r--LayoutTests/storage/resources/database-lock-after-reload-2.html59
-rw-r--r--LayoutTests/storage/resources/stress-frame.html51
-rw-r--r--LayoutTests/storage/sql-data-types-expected.txt7
-rw-r--r--LayoutTests/storage/sql-data-types.html10
-rw-r--r--LayoutTests/storage/sql-data-types.js87
-rw-r--r--LayoutTests/storage/statement-error-callback-expected.txt6
-rw-r--r--LayoutTests/storage/statement-error-callback.html68
-rw-r--r--LayoutTests/storage/success-callback-expected.txt5
-rw-r--r--LayoutTests/storage/success-callback.html54
-rw-r--r--LayoutTests/storage/test-authorizer-expected.txt68
-rw-r--r--LayoutTests/storage/test-authorizer.html175
-rw-r--r--LayoutTests/storage/transaction-callback-exception-crash-expected.txt2
-rw-r--r--LayoutTests/storage/transaction-callback-exception-crash.html20
-rw-r--r--LayoutTests/storage/transaction-error-callback-expected.txt9
-rw-r--r--LayoutTests/storage/transaction-error-callback.html105
367 files changed, 16828 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt b/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt
new file mode 100644
index 0000000..0c80a85
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/argument-types-expected.txt
@@ -0,0 +1,82 @@
+Tests the acceptable types for arguments to Geolocation methods.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS navigator.geolocation.getCurrentPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition({}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition("string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectThrowingException) threw exception Error: enableHighAccuracy getter exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFunction) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string") did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:{}}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:objectThrowingException}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:emptyFunction}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:true}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:42}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:-Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:"string"}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:undefined}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:null}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:{}}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:objectThrowingException}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:emptyFunction}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:true}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:42}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:-Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:"string"}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:undefined}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:null}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:{}}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:objectThrowingException}) threw exception Error: valueOf threw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:emptyFunction}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:true}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:42}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:-Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:"string"}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:undefined}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:null}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:{}}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:objectThrowingException}) threw exception Error: valueOf threw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:emptyFunction}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:true}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:42}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity}) did not throw exception.
+PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"}) did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/argument-types.html b/LayoutTests/fast/dom/Geolocation/argument-types.html
new file mode 100644
index 0000000..f6b0ad4
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/argument-types.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/argument-types.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt
new file mode 100644
index 0000000..ca77390
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/callback-exception-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 22: Error: Exception in success callback
+Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/callback-exception.html b/LayoutTests/fast/dom/Geolocation/callback-exception.html
new file mode 100644
index 0000000..e5f9a7c
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/callback-exception.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/callback-exception.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/enabled-expected.txt b/LayoutTests/fast/dom/Geolocation/enabled-expected.txt
new file mode 100644
index 0000000..c197c5a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/enabled-expected.txt
@@ -0,0 +1,13 @@
+Tests that the navigator.geolocation object is present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS typeof navigator.geolocation == 'object' is true
+PASS hasGeolocationProperty() is true
+PASS 'geolocation' in navigator is true
+PASS navigator.hasOwnProperty('geolocation') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/enabled.html b/LayoutTests/fast/dom/Geolocation/enabled.html
new file mode 100644
index 0000000..bd6381a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/enabled.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/enabled.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/error-expected.txt b/LayoutTests/fast/dom/Geolocation/error-expected.txt
new file mode 100644
index 0000000..ea5d7d8
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/error-expected.txt
@@ -0,0 +1,15 @@
+Tests Geolocation error callback using the mock service.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is mockCode
+PASS error.message is mockMessage
+PASS error.UNKNOWN_ERROR is undefined
+PASS error.PERMISSION_DENIED is 1
+PASS error.POSITION_UNAVAILABLE is 2
+PASS error.TIMEOUT is 3
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/error.html b/LayoutTests/fast/dom/Geolocation/error.html
new file mode 100644
index 0000000..19718c7
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/error.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/error.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
new file mode 100644
index 0000000..63195b2
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
@@ -0,0 +1,14 @@
+Tests that when Geolocation permission has been denied prior to a call to watchPosition, and the watch is cleared in the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
new file mode 100644
index 0000000..2db2637
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied-already-clear-watch.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt
new file mode 100644
index 0000000..e013242
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error-expected.txt
@@ -0,0 +1,14 @@
+Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service encounters an error.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html
new file mode 100644
index 0000000..dc166c9
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-error.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied-already-error.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt
new file mode 100644
index 0000000..f617a5f
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success-expected.txt
@@ -0,0 +1,14 @@
+Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service has a good position.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html
new file mode 100644
index 0000000..4b086a7
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-success.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied-already-success.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt
new file mode 100644
index 0000000..680aa63
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-expected.txt
@@ -0,0 +1,11 @@
+Tests Geolocation when permission is denied, using the mock service.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt
new file mode 100644
index 0000000..d8f50ca
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches-expected.txt
@@ -0,0 +1,11 @@
+Tests that when Geolocation permission is denied, watches are stopped, as well as one-shots.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html
new file mode 100644
index 0000000..92f3a48
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-stops-watches.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied-stops-watches.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied.html b/LayoutTests/fast/dom/Geolocation/permission-denied.html
new file mode 100644
index 0000000..6012079
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/position-string-expected.txt b/LayoutTests/fast/dom/Geolocation/position-string-expected.txt
new file mode 100644
index 0000000..b042998
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/position-string-expected.txt
@@ -0,0 +1,14 @@
+Tests formatting of position.toString().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+PASS position.toString() is "[object Geoposition]"
+PASS position.coords.toString() is "[object Coordinates]"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/position-string.html b/LayoutTests/fast/dom/Geolocation/position-string.html
new file mode 100644
index 0000000..e75a4f5
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/position-string.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/position-string.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt b/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt
new file mode 100644
index 0000000..7420919
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-error-expected.txt
@@ -0,0 +1,14 @@
+Tests that reentrant calls to Geolocation methods from the error callback are OK.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is mockCode
+PASS error.message is mockMessage
+
+PASS error.code is mockCode
+PASS error.message is mockMessage
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-error.html b/LayoutTests/fast/dom/Geolocation/reentrant-error.html
new file mode 100644
index 0000000..f3300af
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-error.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/reentrant-error.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt b/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt
new file mode 100644
index 0000000..ad63fa3
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-success-expected.txt
@@ -0,0 +1,16 @@
+Tests that reentrant calls to Geolocation methods from the success callback are OK.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/reentrant-success.html b/LayoutTests/fast/dom/Geolocation/reentrant-success.html
new file mode 100644
index 0000000..f09cf28
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/reentrant-success.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/reentrant-success.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html b/LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html
new file mode 100644
index 0000000..fcb8be1
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/TEMPLATE.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/argument-types.js b/LayoutTests/fast/dom/Geolocation/resources/argument-types.js
new file mode 100644
index 0000000..956e3d6
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/argument-types.js
@@ -0,0 +1,119 @@
+description("Tests the acceptable types for arguments to Geolocation methods.");
+
+function shouldNotThrow(expression)
+{
+ try {
+ eval(expression);
+ testPassed(expression + " did not throw exception.");
+ } catch(e) {
+ testFailed(expression + " should not throw exception. Threw exception " + e);
+ }
+}
+
+function test(expression, expressionShouldThrow, expectedException) {
+ if (expressionShouldThrow) {
+ if (expectedException)
+ shouldThrow(expression, '(function() { return "' + expectedException + '"; })();');
+ else
+ shouldThrow(expression, '(function() { return "Error: TYPE_MISMATCH_ERR: DOM Exception 17"; })();');
+ } else {
+ shouldNotThrow(expression);
+ }
+}
+
+var emptyFunction = function() {};
+
+function ObjectThrowingException() {};
+ObjectThrowingException.prototype.valueOf = function() {
+ throw new Error('valueOf threw exception');
+}
+ObjectThrowingException.prototype.__defineGetter__("enableHighAccuracy", function() {
+ throw new Error('enableHighAccuracy getter exception');
+});
+var objectThrowingException = new ObjectThrowingException();
+
+
+test('navigator.geolocation.getCurrentPosition()', true);
+
+test('navigator.geolocation.getCurrentPosition(undefined)', true);
+test('navigator.geolocation.getCurrentPosition(null)', true);
+test('navigator.geolocation.getCurrentPosition({})', true);
+test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(true)', true);
+test('navigator.geolocation.getCurrentPosition(42)', true);
+test('navigator.geolocation.getCurrentPosition(Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(-Infinity)', true);
+test('navigator.geolocation.getCurrentPosition("string")', true);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectThrowingException)', true, 'Error: enableHighAccuracy getter exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string")', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:objectThrowingException})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:objectThrowingException})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:objectThrowingException})', true, 'Error: valueOf threw exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:objectThrowingException})', true, 'Error: valueOf threw exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"})', false);
+
+var isAsynchronous = false;
+var successfullyParsed = true;
+
diff --git a/LayoutTests/fast/dom/Geolocation/resources/callback-exception.js b/LayoutTests/fast/dom/Geolocation/resources/callback-exception.js
new file mode 100644
index 0000000..d5cd682
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/callback-exception.js
@@ -0,0 +1,36 @@
+description("Tests that when an exception is thrown in the success callback, the error callback is not invoked. Note that this test throws an exception which is not caught.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100;
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude,
+ mockLongitude,
+ mockAccuracy);
+
+var position;
+navigator.geolocation.getCurrentPosition(function(p) {
+ position = p
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+
+ // Yield to allow for the error callback to be invoked. The timer
+ // must be started before the exception is thrown.
+ window.setTimeout(completeTest, 0);
+ throw new Error('Exception in success callback');
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+});
+
+function completeTest()
+{
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/enabled.js b/LayoutTests/fast/dom/Geolocation/resources/enabled.js
new file mode 100644
index 0000000..4e99984
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/enabled.js
@@ -0,0 +1,18 @@
+description("Tests that the navigator.geolocation object is present.");
+
+function hasGeolocationProperty()
+{
+ for (var property in navigator) {
+ if (property == "geolocation")
+ return true;
+ }
+ return false;
+}
+
+shouldBeTrue("typeof navigator.geolocation == 'object'");
+shouldBeTrue("hasGeolocationProperty()");
+shouldBeTrue("'geolocation' in navigator");
+shouldBeTrue("navigator.hasOwnProperty('geolocation')");
+
+var isAsynchronous = false;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/error.js b/LayoutTests/fast/dom/Geolocation/resources/error.js
new file mode 100644
index 0000000..c76570b
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/error.js
@@ -0,0 +1,27 @@
+description("Tests Geolocation error callback using the mock service.");
+
+var mockCode = 0;
+var mockMessage = "debug";
+
+window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+ shouldBe('error.UNKNOWN_ERROR', 'undefined');
+ shouldBe('error.PERMISSION_DENIED', '1');
+ shouldBe('error.POSITION_UNAVAILABLE', '2');
+ shouldBe('error.TIMEOUT', '3');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js b/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js
new file mode 100644
index 0000000..558f149
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/js-test-post.js
@@ -0,0 +1,4 @@
+shouldBeTrue("successfullyParsed");
+if (!isAsynchronous) {
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+}
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js
new file mode 100644
index 0000000..1e980a5
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js
@@ -0,0 +1,42 @@
+description("Tests that when Geolocation permission has been denied prior to a call to watchPosition, and the watch is cleared in the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
+
+// Prime the Geolocation instance by denying permission.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ continueTest();
+});
+
+function continueTest()
+{
+ // Make another request, with permission already denied.
+ var watchId = navigator.geolocation.watchPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ navigator.geolocation.clearWatch(watchId);
+ window.setTimeout(completeTest, 0);
+ });
+}
+
+function completeTest()
+{
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js
new file mode 100644
index 0000000..77c8259
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-error.js
@@ -0,0 +1,38 @@
+description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service encounters an error.");
+
+// Prime the Geolocation instance by denying permission.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ continueTest();
+});
+
+function continueTest()
+{
+ // Make another request, with permission already denied.
+ window.layoutTestController.setMockGeolocationError(0, 'test');
+
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ });
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js
new file mode 100644
index 0000000..966c64d
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-success.js
@@ -0,0 +1,36 @@
+description("Tests that when Geolocation permission has been denied prior to a call to a Geolocation method, the error callback is invoked with code PERMISSION_DENIED, when the Geolocation service has a good position.");
+
+// Prime the Geolocation instance by denying permission.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('');
+ continueTest();
+});
+
+function continueTest()
+{
+ // Make another request, with permission already denied.
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ });
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js
new file mode 100644
index 0000000..89e5004
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-stops-watches.js
@@ -0,0 +1,38 @@
+description("Tests that when Geolocation permission is denied, watches are stopped, as well as one-shots.");
+
+// Configure the mock Geolocation service to report a position to cause permission
+// to be requested, then deny it.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+var error;
+var errorCallbackInvoked = false;
+navigator.geolocation.watchPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ if (errorCallbackInvoked) {
+ testFailed('Error callback invoked unexpectedly : ' + error.message);
+ window.layoutTestController.notifyDone();
+ }
+ errorCallbackInvoked = true;
+
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+
+ // Update the mock Geolocation service to report a new position, then
+ // yield to allow a chance for the success callback to be invoked.
+ window.layoutTestController.setMockGeolocationPosition(55.478, -0.166, 100);
+ window.setTimeout(completeTest, 0);
+});
+
+function completeTest()
+{
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied.js
new file mode 100644
index 0000000..1915469
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied.js
@@ -0,0 +1,20 @@
+description("Tests Geolocation when permission is denied, using the mock service.");
+
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.PERMISSION_DENIED');
+ shouldBe('error.message', '"User denied Geolocation"');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/position-string.js b/LayoutTests/fast/dom/Geolocation/resources/position-string.js
new file mode 100644
index 0000000..6365fca
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/position-string.js
@@ -0,0 +1,30 @@
+description("Tests formatting of position.toString().");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude,
+ mockLongitude,
+ mockAccuracy);
+
+var position;
+navigator.geolocation.getCurrentPosition(function(p) {
+ // shouldBe can't use local variables yet.
+ position = p
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ shouldBe('position.toString()', '"[object Geoposition]"');
+ shouldBe('position.coords.toString()', '"[object Coordinates]"');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js b/LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js
new file mode 100644
index 0000000..32858bf
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/reentrant-error.js
@@ -0,0 +1,47 @@
+description("Tests that reentrant calls to Geolocation methods from the error callback are OK.");
+
+var mockCode = 0;
+var mockMessage = 'test';
+
+window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+
+var error;
+var errorCallbackInvoked = false;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ if (errorCallbackInvoked) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }
+ errorCallbackInvoked = true;
+
+ error = e;
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+ debug('');
+ continueTest();
+});
+
+function continueTest() {
+ mockCode += 1;
+ mockMessage += ' repeat';
+
+ window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ error = e;
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ });
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js b/LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js
new file mode 100644
index 0000000..12dfe39
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/reentrant-success.js
@@ -0,0 +1,52 @@
+description("Tests that reentrant calls to Geolocation methods from the success callback are OK.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude,
+ mockLongitude,
+ mockAccuracy);
+
+var position;
+var successCallbackInvoked = false;
+navigator.geolocation.getCurrentPosition(function(p) {
+ if (successCallbackInvoked) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }
+ successCallbackInvoked = true;
+
+ position = p;
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ debug('');
+ continueTest();
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+});
+
+function continueTest() {
+ window.layoutTestController.setMockGeolocationPosition(++mockLatitude,
+ ++mockLongitude,
+ ++mockAccuracy);
+
+ navigator.geolocation.getCurrentPosition(function(p) {
+ position = p;
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ }, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ });
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/success.js b/LayoutTests/fast/dom/Geolocation/resources/success.js
new file mode 100644
index 0000000..c5f566f
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/success.js
@@ -0,0 +1,27 @@
+description("Tests Geolocation success callback using the mock service.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100;
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude,
+ mockLongitude,
+ mockAccuracy);
+
+var position;
+navigator.geolocation.getCurrentPosition(function(p) {
+ position = p
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js b/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js
new file mode 100644
index 0000000..e9d247a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js
@@ -0,0 +1,27 @@
+description("Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
+
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+var error;
+var watchId = navigator.geolocation.watchPosition(function() {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.TIMEOUT');
+ shouldBe('error.message', '"Timeout expired"');
+ navigator.geolocation.clearWatch(watchId);
+ window.setTimeout(completeTest, 0);
+}, {
+ timeout: 0
+});
+
+function completeTest()
+{
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js b/LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js
new file mode 100644
index 0000000..8a930d9
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/timeout-zero.js
@@ -0,0 +1,21 @@
+description("Tests that when timeout is zero (and maximumAge is too), the error callback is called immediately with code TIMEOUT.");
+
+layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ error = e
+ shouldBe('error.code', 'error.TIMEOUT');
+ shouldBe('error.message', '"Timeout expired"');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}, {
+ timeout: 0
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout.js b/LayoutTests/fast/dom/Geolocation/resources/timeout.js
new file mode 100644
index 0000000..d4fa1a7
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/timeout.js
@@ -0,0 +1,29 @@
+description("Tests that when timeout is non-zero, the success callback is called as expected.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude,
+ mockLongitude,
+ mockAccuracy);
+
+var position;
+navigator.geolocation.getCurrentPosition(function(p) {
+ position = p;
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+}, function(e) {
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+}, {
+ timeout: 1000
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/watch.js b/LayoutTests/fast/dom/Geolocation/resources/watch.js
new file mode 100644
index 0000000..dbf4272
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/watch.js
@@ -0,0 +1,65 @@
+description("Tests that watchPosition correctly reports position updates and errors from the Geolocation service.");
+
+var mockLatitude = 51.478;
+var mockLongitude = -0.166;
+var mockAccuracy = 100.0;
+
+var mockCode = 1;
+var mockMessage = 'test';
+
+var position;
+var error;
+
+function checkPosition(p) {
+ position = p;
+ shouldBe('position.coords.latitude', 'mockLatitude');
+ shouldBe('position.coords.longitude', 'mockLongitude');
+ shouldBe('position.coords.accuracy', 'mockAccuracy');
+ debug('');
+}
+
+function checkError(e) {
+ error = e;
+ shouldBe('error.code', 'mockCode');
+ shouldBe('error.message', 'mockMessage');
+ debug('');
+}
+
+window.layoutTestController.setGeolocationPermission(true);
+window.layoutTestController.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy);
+
+var state = 0;
+navigator.geolocation.watchPosition(function(p) {
+ switch (state++) {
+ case 0:
+ checkPosition(p);
+ window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
+ break;
+ case 1:
+ checkPosition(p);
+ window.layoutTestController.setMockGeolocationError(mockCode, mockMessage);
+ break;
+ case 3:
+ checkPosition(p);
+ debug('<br /><span class="pass">TEST COMPLETE</span>');
+ window.layoutTestController.notifyDone();
+ break;
+ default:
+ testFailed('Success callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }
+}, function(e) {
+ switch (state++) {
+ case 2:
+ checkError(e);
+ window.layoutTestController.setMockGeolocationPosition(++mockLatitude, ++mockLongitude, ++mockAccuracy);
+ break;
+ default:
+ testFailed('Error callback invoked unexpectedly');
+ window.layoutTestController.notifyDone();
+ }
+});
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/success-expected.txt b/LayoutTests/fast/dom/Geolocation/success-expected.txt
new file mode 100644
index 0000000..a063801
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/success-expected.txt
@@ -0,0 +1,12 @@
+Tests Geolocation success callback using the mock service.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/success.html b/LayoutTests/fast/dom/Geolocation/success.html
new file mode 100644
index 0000000..ecd7a25
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/success.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/success.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
new file mode 100644
index 0000000..e97fccd
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
@@ -0,0 +1,11 @@
+Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.TIMEOUT
+PASS error.message is "Timeout expired"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
new file mode 100644
index 0000000..45c7735
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/timeout-clear-watch.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-expected.txt
new file mode 100644
index 0000000..c673cd2
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-expected.txt
@@ -0,0 +1,12 @@
+Tests that when timeout is non-zero, the success callback is called as expected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt
new file mode 100644
index 0000000..f083301
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-zero-expected.txt
@@ -0,0 +1,11 @@
+Tests that when timeout is zero (and maximumAge is too), the error callback is called immediately with code TIMEOUT.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.TIMEOUT
+PASS error.message is "Timeout expired"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-zero.html b/LayoutTests/fast/dom/Geolocation/timeout-zero.html
new file mode 100644
index 0000000..955398e
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-zero.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/timeout-zero.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/timeout.html b/LayoutTests/fast/dom/Geolocation/timeout.html
new file mode 100644
index 0000000..f8eaafe
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/timeout.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/watch-expected.txt b/LayoutTests/fast/dom/Geolocation/watch-expected.txt
new file mode 100644
index 0000000..0f923dc
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/watch-expected.txt
@@ -0,0 +1,24 @@
+Tests that watchPosition correctly reports position updates and errors from the Geolocation service.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+PASS error.code is mockCode
+PASS error.message is mockMessage
+
+PASS position.coords.latitude is mockLatitude
+PASS position.coords.longitude is mockLongitude
+PASS position.coords.accuracy is mockAccuracy
+
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/watch.html b/LayoutTests/fast/dom/Geolocation/watch.html
new file mode 100644
index 0000000..6568883
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/watch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/watch.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/JSON-parse.js b/LayoutTests/fast/js/resources/JSON-parse.js
new file mode 100644
index 0000000..b78df25
--- /dev/null
+++ b/LayoutTests/fast/js/resources/JSON-parse.js
@@ -0,0 +1,576 @@
+
+function createTests() {
+ var result = [];
+ result.push(function(jsonObject){
+ return jsonObject.parse();
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('1');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('-1');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('Infinity');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('NaN');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('null');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('undefined');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{}');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('({})');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{a}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{a:}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{a:5}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{a:5,}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a"}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":5}');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"__proto__":5}');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":5,}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":5,,}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":5,"a",}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"a":(5,"a"),}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('[]');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('[1]');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('[1,]');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('[1,2]');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('[1,2,,]');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('[1,2,,4]');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('""');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"\'"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\z"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\\z"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\\\z"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\tz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\tz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\nz"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\nz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\rz"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\rz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\/z"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\/z"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\bz"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\bz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\rz"');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\rz"');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\uz" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u00z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u000z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0000z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u000Az" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u000az" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u000Gz" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u000gz" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u00A0z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u00a0z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u00G0z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u00g0z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0A00z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0a00z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0G00z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\u0g00z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\uA000z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\ua000z" ');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\uG000z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a\\ug000z" ');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('00');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('01');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('0.a');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('0x0');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('2e1.3');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('2e-+10');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('2e+-10');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('2e3e4');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('-01.0');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('-01');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('-01.a');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('1.e1');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{/* block comments are not allowed */}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('{// line comments are not allowed \n}');
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.parse('true');
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('false');
+ });
+ var simpleArray = ['a', 'b', 'c'];
+ var simpleObject = {a:"1", b:"2", c:"3"};
+ var complexArray = ['a', 'b', 'c',,,simpleObject, simpleArray, [simpleObject,simpleArray]];
+ var complexObject = {a:"1", b:"2", c:"3", d:4.5e10, g: 0.45e-5, h: 0.0, i: 0, j:.5, k:0., l:-0, m:-0.0, n:-0., o:-.5, p:-0.45e-10, q:-4.5e10, e:null, "":12, f: simpleArray, array: complexArray};
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject));
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject));
+ });
+ result[result.length - 1].expected = JSON.stringify(complexObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject,null,100));
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null,100));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null,100));
+ });
+ result[result.length - 1].expected = JSON.stringify(complexObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject,null," "));
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null," "));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null," "));
+ });
+ result[result.length - 1].expected = JSON.stringify(complexObject);
+
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject,null,"\t"));
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null,"\t"));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null,"\t"));
+ });
+ result[result.length - 1].expected = JSON.stringify(complexObject);
+
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject,null,"\n"));
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject,null,"\n"));
+ });
+ result[result.length - 1].expected = JSON.stringify(complexObject);
+ function log(key, value) {
+ var o = {};
+ o[key] = value;
+ o.keyType = typeof key;
+ return o;
+ }
+ result.push(function(jsonObject){
+ return jsonObject.parse("true", log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse("false", log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse("null", log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse("1", log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse("1.5", log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('"a string"', log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleArray), log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexArray), log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(simpleObject), log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(complexObject), log);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.parse('{"__proto__":{"a":5}}', log);
+ });
+ var logOrderString;
+ function logOrder(key, value) {
+ logOrderString += key +":"+JSON.stringify(value);
+ return null;
+ }
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse("true", logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse("false", logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse("null", logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse("1", logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse("1.5", logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse('"a string"', logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(simpleArray), logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(complexArray), logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(simpleObject), logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(complexObject), logOrder);
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse("true", logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse("false", logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse("null", logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse("1", logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse("1.5", logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse('"a string"', logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse(JSON.stringify(simpleArray), logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse(JSON.stringify(complexArray), logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse(JSON.stringify(simpleObject), logOrder);
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ logOrderString = "";
+ jsonObject.parse(JSON.stringify(complexObject), logOrder);
+ return logOrderString;
+ });
+ var callCount = 0;
+ function throwAfterFifthCall(key, value) {
+ logOrder(key, value);
+ if (++callCount > 5)
+ throw "from reviver";
+ return null;
+ }
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(complexArray), throwAfterFifthCall);
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(simpleObject), throwAfterFifthCall);
+ });
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ return jsonObject.parse(JSON.stringify(complexObject), throwAfterFifthCall);
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ try { jsonObject.parse(JSON.stringify(complexArray), throwAfterFifthCall); } catch (e) {}
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ try { jsonObject.parse(JSON.stringify(simpleObject), throwAfterFifthCall); } catch (e) {}
+ return logOrderString;
+ });
+ result.push(function(jsonObject){
+ callCount = 0;
+ logOrderString = "";
+ try { jsonObject.parse(JSON.stringify(complexObject), throwAfterFifthCall); } catch (e) {}
+ return logOrderString;
+ });
+ var unicode = "";
+ for (var i = 0; i < 1<<16; i++)
+ unicode += String.fromCharCode(i);
+ result.push(function(jsonObject){
+ return jsonObject.parse(JSON.stringify(unicode));
+ });
+ result[result.length - 1].unstringifiedExpected = unicode;
+ return result;
+}
+var tests = createTests();
+for (var i = 0; i < tests.length; i++) {
+ try {
+ debug(tests[i]);
+ if (tests[i].throws) {
+ shouldThrow('tests[i](nativeJSON)');
+ try {
+ var threw = false;
+ tests[i](JSON);
+ } catch(e) {
+ var threw = true;
+ }
+ if (!threw)
+ debug("json2.js did not throw for a test we expect to throw.");
+ } else if (tests[i].expected)
+ try { shouldBe('JSON.stringify(tests[i](nativeJSON))', "tests[i].expected") } catch(e) { debug("threw - " + e)}
+ else if (tests[i].unstringifiedExpected)
+ try { shouldBe('tests[i](nativeJSON)', "tests[i].unstringifiedExpected") } catch(e) { debug("threw - " + e)}
+ else
+ try { shouldBe('JSON.stringify(tests[i](nativeJSON))', 'JSON.stringify(tests[i](JSON))') } catch(e) { debug("threw - " + e) };
+ }catch(e){
+ debug(e);
+ }
+}
+successfullyParsed = true;
+
diff --git a/LayoutTests/fast/js/resources/JSON-stringify.js b/LayoutTests/fast/js/resources/JSON-stringify.js
new file mode 100644
index 0000000..d58b5fe
--- /dev/null
+++ b/LayoutTests/fast/js/resources/JSON-stringify.js
@@ -0,0 +1,508 @@
+
+function createTests() {
+ var simpleArray = ['a', 'b', 'c'];
+ var simpleObject = {a:"1", b:"2", c:"3"};
+ var complexArray = ['a', 'b', 'c',,,simpleObject, simpleArray, [simpleObject,simpleArray]];
+ var complexObject = {a:"1", b:"2", c:"3", d:undefined, e:null, "":12, get f(){ return simpleArray; }, array: complexArray};
+ var simpleArrayWithProto = ['d', 'e', 'f'];
+ simpleArrayWithProto.__proto__ = simpleObject;
+ var simpleObjectWithProto = {d:"4", e:"5", f:"6", __proto__:simpleObject};
+ var complexArrayWithProto = ['d', 'e', 'f',,,simpleObjectWithProto, simpleArrayWithProto, [simpleObjectWithProto,simpleArrayWithProto]];
+ complexArrayWithProto.__proto__ = simpleObjectWithProto;
+ var complexObjectWithProto = {d:"4", e:"5", f:"6", g:undefined, h:null, "":12, get i(){ return simpleArrayWithProto; }, array2: complexArrayWithProto, __proto__:complexObject};
+ var objectWithSideEffectGetter = {get b() {this.foo=1;}};
+ var objectWithSideEffectGetterAndProto = {__proto__:{foo:"bar"}, get b() {this.foo=1;}};
+ var arrayWithSideEffectGetter = [];
+ arrayWithSideEffectGetter.__defineGetter__("b", function(){this.foo=1;});
+ var arrayWithSideEffectGetterAndProto = [];
+ arrayWithSideEffectGetterAndProto.__defineGetter__("b", function(){this.foo=1;});
+ arrayWithSideEffectGetterAndProto.__proto__ = {foo:"bar"};
+ var result = [];
+ result.push(function(jsonObject){
+ return jsonObject.stringify(1);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(1.5);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(-1);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(-1.5);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(null);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify("string");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Number(0));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Number(1));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Number(1.5));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Number(-1));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Number(-1.5));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new String("a string object"));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Boolean(true));
+ });
+ result.push(function(jsonObject){
+ var value = new Number(1);
+ value.valueOf = function() { return 2; }
+ return jsonObject.stringify(value);
+ });
+ result[result.length - 1].expected = '2';
+ result.push(function(jsonObject){
+ var value = new Boolean(true);
+ value.valueOf = function() { return 2; }
+ return jsonObject.stringify(value);
+ });
+ result[result.length - 1].expected = '2';
+ result.push(function(jsonObject){
+ var value = new String("fail");
+ value.toString = function() { return "converted string"; }
+ return jsonObject.stringify(value);
+ });
+ result[result.length - 1].expected = '"converted string"';
+ result.push(function(jsonObject){
+ return jsonObject.stringify(true);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(false);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Date(0));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON: Date.prototype.toJSON});
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return "custom toISOString"; }});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ return {}; }});
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON: Date.prototype.toJSON, toISOString: function(){ throw "An exception"; }});
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ var d = new Date(0);
+ d.toISOString = null;
+ return jsonObject.stringify(d);
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ var d = new Date(0);
+ d.toJSON = undefined;
+ return jsonObject.stringify(d);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({get Foo() { return "bar"; }});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({get Foo() { this.foo="wibble"; return "bar"; }});
+ });
+ result.push(function(jsonObject){
+ var count = 0;
+ jsonObject.stringify({get Foo() { count++; return "bar"; }});
+ return count;
+ });
+ result.push(function(jsonObject){
+ var count = 0;
+ return jsonObject.stringify({get Foo() { count++; delete this.bar; return "bar"; }, bar: "wibble"});
+ });
+ result.push(function(jsonObject){
+ var count = 0;
+ return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7});
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, function(k,v){allString = allString && (typeof k == "string"); return v});
+ return allString;
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ jsonObject.stringify([1,2,3,4,5], function(k,v){allString = allString && (typeof k == "string"); return v});
+ return allString;
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = [];
+ return jsonObject.stringify({a:"1", b:"2", c:"3", 5:4, 4:5, 2:6, 1:7}, array);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = ["a"];
+ return jsonObject.stringify({get a(){return 1;array[1]="b";array[2]="c"}, b:"2", c:"3"}, array);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
+ return jsonObject.stringify(simpleObject, array);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
+ return jsonObject.stringify(simpleObjectWithProto, array);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = [1, new Number(2), NaN, Infinity, -Infinity, new String("str")];
+ return jsonObject.stringify({"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}, array);
+ });
+ result[result.length - 1].expected = '{"1":"1","2":"2","NaN":"NaN","Infinity":"Infinity","-Infinity":"-Infinity","str":"str"}';
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = ["1","2","3"];
+ return jsonObject.stringify({1:'a', 2:'b', 3:'c'}, array);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = ["1","2","3"];
+ return jsonObject.stringify(simpleArray, array);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArray, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArray, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArray, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArray, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, 10);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, 11);
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, " ");
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObject, null, " ");
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObject, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArray, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArray, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArray, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArray, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObject, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObject, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObject, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObject, null, 4);
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = ["1","2","3"];
+ return jsonObject.stringify(simpleArrayWithProto, array);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArrayWithProto, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArrayWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArrayWithProto, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleArrayWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, 10);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, 11);
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, " ");
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(simpleObjectWithProto, null, " ");
+ });
+ result[result.length - 1].expected = JSON.stringify(simpleObjectWithProto, null, 10);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArrayWithProto, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArrayWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArrayWithProto, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexArrayWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObjectWithProto, null, " ");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObjectWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObjectWithProto, null, "ab");
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(complexObjectWithProto, null, 4);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(objectWithSideEffectGetter);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(objectWithSideEffectGetterAndProto);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(arrayWithSideEffectGetter);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(arrayWithSideEffectGetterAndProto);
+ });
+ var replaceTracker;
+ function replaceFunc(key, value) {
+ replaceTracker += key + "("+(typeof key)+")" + JSON.stringify(value) + ";";
+ return value;
+ }
+ result.push(function(jsonObject){
+ replaceTracker = "";
+ jsonObject.stringify([1,2,3,,,,4,5,6], replaceFunc);
+ return replaceTracker;
+ });
+ result[result.length - 1].expected = '(string)[1,2,3,null,null,null,4,5,6];0(number)1;1(number)2;2(number)3;3(number)undefined;4(number)undefined;5(number)undefined;6(number)4;7(number)5;8(number)6;'
+ result.push(function(jsonObject){
+ replaceTracker = "";
+ jsonObject.stringify({a:"a", b:"b", c:"c", 3: "d", 2: "e", 1: "f"}, replaceFunc);
+ return replaceTracker;
+ });
+ result[result.length - 1].expected = '(string){"a":"a","b":"b","c":"c","3":"d","2":"e","1":"f"};a(string)"a";b(string)"b";c(string)"c";3(string)"d";2(string)"e";1(string)"f";';
+ result.push(function(jsonObject){
+ var count = 0;
+ var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}];
+ jsonObject.stringify(simpleObject, array);
+ return count;
+ });
+ result.push(function(jsonObject){
+ var allString = true;
+ var array = [{toString:function(){array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];
+ return jsonObject.stringify(simpleObject, array);
+ });
+ result.push(function(jsonObject){
+ var count = 0;
+ var array = [{toString:function(){count++; array[0]='a'; array[1]='c'; array[2]='b'; return 'a'}}, 'b', 'c'];
+ jsonObject.stringify(simpleObject, array);
+ return count;
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:"1", get b() { this.a="foo"; return "getter"; }, c:"3"});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:"1", get b() { this.c="foo"; return "getter"; }, c:"3"});
+ });
+ result.push(function(jsonObject){
+ var setterCalled = false;
+ jsonObject.stringify({a:"1", set b(s) { setterCalled = true; return "setter"; }, c:"3"});
+ return setterCalled;
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:"1", get b(){ return "getter"; }, set b(s) { return "setter"; }, c:"3"});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(new Array(10));
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify([undefined,,null,0,false]);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({p1:undefined,p2:null,p3:0,p4:false});
+ });
+ var cycleTracker = "";
+ var cyclicObject = { get preSelf1() { cycleTracker+="preSelf1,"; return "preSelf1"; },
+ preSelf2: {toJSON:function(){cycleTracker+="preSelf2,"; return "preSelf2"}},
+ self: [],
+ get postSelf1() { cycleTracker+="postSelf1,"; return "postSelf1" },
+ postSelf2: {toJSON:function(){cycleTracker+="postSelf2,"; return "postSelf2"}},
+ toJSON : function(key) { cycleTracker += key + "("+(typeof key)+"):" + this; return this; }
+ };
+ cyclicObject.self = cyclicObject;
+ result.push(function(jsonObject){
+ cycleTracker = "";
+ return jsonObject.stringify(cyclicObject);
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ cycleTracker = "";
+ try { jsonObject.stringify(cyclicObject); } catch(e) { cycleTracker += " -> exception" }
+ return cycleTracker;
+ });
+ result[result.length - 1].expected = "(string):[object Object]preSelf1,preSelf2,self(string):[object Object] -> exception"
+ var cyclicArray = [{toJSON : function(key,value) { cycleTracker += key + "("+(typeof key)+"):" + this; cycleTracker += "first,"; return this; }},
+ cyclicArray,
+ {toJSON : function(key,value) { cycleTracker += key + "("+(typeof key)+"):" + this; cycleTracker += "second,"; return this; }}];
+ cyclicArray[1] = cyclicArray;
+ result.push(function(jsonObject){
+ cycleTracker = "";
+ return jsonObject.stringify(cyclicArray);
+ });
+ result[result.length - 1].throws = true;
+ result.push(function(jsonObject){
+ cycleTracker = "";
+ try { jsonObject.stringify(cyclicArray); } catch(e) { cycleTracker += " -> exception" }
+ return cycleTracker;
+ });
+ result[result.length - 1].expected = "0(number):[object Object]first, -> exception";
+ function createArray(len, o) { var r = []; for (var i = 0; i < len; i++) r[i] = o; return r; }
+ var getterCalls;
+ var magicObject = createArray(10, {abcdefg: [1,2,5,"ab", null, undefined, true, false,,],
+ get calls() {return ++getterCalls; },
+ "123":createArray(15, "foo"),
+ "":{a:"b"}});
+ result.push(function(jsonObject){
+ getterCalls = 0;
+ return jsonObject.stringify(magicObject) + " :: getter calls = " + getterCalls;
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(undefined);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify(null);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON:function(){ return undefined; }});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({toJSON:function(){ return null; }});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify([{toJSON:function(){ return undefined; }}]);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify([{toJSON:function(){ return null; }}]);
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:{toJSON:function(){ return undefined; }}});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:{toJSON:function(){ return null; }}});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:{toJSON:function(){ return function(){}; }}});
+ });
+ result.push(function(jsonObject){
+ return jsonObject.stringify({a:function(){}});
+ });
+ result.push(function(jsonObject){
+ var deepObject = {};
+ for (var i = 0; i < 2048; i++)
+ deepObject = {next:deepObject};
+ return jsonObject.stringify(deepObject);
+ });
+ result.push(function(jsonObject){
+ var deepArray = [];
+ for (var i = 0; i < 2048; i++)
+ deepArray = [deepArray];
+ return jsonObject.stringify(deepArray);
+ });
+ result.push(function(jsonObject){
+ var depth = 0;
+ function toDeepVirtualJSONObject() {
+ if (++depth >= 2048)
+ return {};
+ var r = {};
+ r.toJSON = toDeepVirtualJSONObject;
+ return {recurse: r};
+ }
+ return jsonObject.stringify(toDeepVirtualJSONObject());
+ });
+ result.push(function(jsonObject){
+ var depth = 0;
+ function toDeepVirtualJSONArray() {
+ if (++depth >= 2048)
+ return [];
+ var r = [];
+ r.toJSON = toDeepJSONArray;
+ return [r];
+ }
+ return jsonObject.stringify(toDeepVirtualJSONArray());
+ });
+ var fullCharsetString = "";
+ for (var i = 0; i < 65536; i++)
+ fullCharsetString += String.fromCharCode(i);
+ result.push(function(jsonObject){
+ return jsonObject.stringify(fullCharsetString);
+ });
+ return result;
+}
+var tests = createTests();
+for (var i = 0; i < tests.length; i++) {
+ try {
+ debug(tests[i]);
+ if (tests[i].throws)
+ shouldThrow('tests[i](nativeJSON)');
+ else if (tests[i].expected)
+ shouldBe('tests[i](nativeJSON)', "tests[i].expected");
+ else
+ shouldBe('tests[i](nativeJSON)', "tests[i](JSON)");
+ }catch(e){}
+}
+successfullyParsed = true;
+
diff --git a/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js b/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js
new file mode 100644
index 0000000..b62a250
--- /dev/null
+++ b/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js
@@ -0,0 +1,2 @@
+description("This ensures that BOM's scattered through a source file do not break parsing");
+function f(){successfullyReparsed=true;shouldBeTrue('successfullyReparsed');successfullyParsed=true}f();
diff --git a/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-1.js b/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-1.js
new file mode 100644
index 0000000..2871af3
--- /dev/null
+++ b/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-1.js
@@ -0,0 +1,47 @@
+function assign1()
+{
+ v1 = 0;
+ return 1;
+}
+
+function assign2()
+{
+ v2 = { a: 0 };
+ return 2;
+}
+
+function assign3()
+{
+ v3 = { a: 0 };
+ return 1;
+}
+
+function assign4()
+{
+ v4 = { a: 0 };
+ return "a";
+}
+
+function assign5()
+{
+ v5 = { a: 0 };
+ return "a";
+}
+
+function assign6()
+{
+ v6 = { a: 0 };
+ return 2;
+}
+
+function assign7()
+{
+ v7 = { a: 0 };
+ return "a";
+}
+
+function assign8()
+{
+ v8 = { a: 0 };
+ return 1;
+}
diff --git a/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-2.js b/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-2.js
new file mode 100644
index 0000000..bc92860
--- /dev/null
+++ b/LayoutTests/fast/js/resources/codegen-temporaries-multiple-global-blocks-2.js
@@ -0,0 +1,43 @@
+description(
+'Tests whether bytecode codegen properly handles temporaries across multiple global blocks.'
+);
+
+var v1 = 1;
+v1 += assign1();
+shouldBe("v1", "2");
+
+var o2 = { a: 1 };
+var v2 = o2;
+v2.a = assign2();
+shouldBe("o2.a", "2");
+
+var o3 = { a: 1 };
+var v3 = o3;
+v3.a += assign3();
+shouldBe("o3.a", "2");
+
+var v4 = { a: 1 };
+var r4 = v4[assign4()];
+shouldBe("r4", "1");
+
+var o5 = { a: 1 };
+var v5 = o5;
+v5[assign5()] = 2;
+shouldBe("o5.a", "2");
+
+var o6 = { a: 1 };
+var v6 = o6;
+v6["a"] = assign6();
+shouldBe("o6.a", "2");
+
+var o7 = { a: 1 };
+var v7 = o7;
+v7[assign7()] += 1;
+shouldBe("o7.a", "2");
+
+var o8 = { a: 1 };
+var v8 = o8;
+v8["a"] += assign8();
+shouldBe("o8.a", "2");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/const.js b/LayoutTests/fast/js/resources/const.js
new file mode 100644
index 0000000..cc5e127
--- /dev/null
+++ b/LayoutTests/fast/js/resources/const.js
@@ -0,0 +1,120 @@
+description(
+"This test checks that const declarations in JavaScript work and are readonly."
+);
+
+
+shouldThrow("const redef='a'; const redef='a';");
+
+const x = "RIGHT";
+x = "WRONG";
+shouldBe("x", '"RIGHT"');
+
+const z = "RIGHT", y = "RIGHT";
+y = "WRONG";
+shouldBe("y", '"RIGHT"');
+
+const one = 1;
+
+var a;
+
+// PostIncResolveNode
+a = one++;
+shouldBe("a", "1");
+shouldBe("one", "1");
+
+// PostDecResolveNode
+a = one--;
+shouldBe("a", "1");
+shouldBe("one", "1");
+
+// PreIncResolveNode
+a = ++one;
+shouldBe("a", "2");
+shouldBe("one", "1");
+
+// PreDecResolveNode
+a = --one;
+shouldBe("a", "0");
+shouldBe("one", "1");
+
+// ReadModifyConstNode
+a = one += 2;
+shouldBe("a", "3");
+shouldBe("one", "1");
+
+// AssignConstNode
+a = one = 2;
+shouldBe("a", "2");
+shouldBe("one", "1");
+
+// PostIncResolveNode
+shouldBe("function f() { const one = 1; one++; return one; } f();", "1");
+shouldBe("function f() { const oneString = '1'; return oneString++; } f();", "1");
+shouldBe("function f() { const one = 1; return one++; } f();", "1");
+
+// PostDecResolveNode
+shouldBe("function f() { const one = 1; one--; return one; } f();", "1");
+shouldBe("function f() { const oneString = '1'; return oneString--; } f();", "1");
+shouldBe("function f() { const one = 1; return one--; } f();", "1");
+
+// PreIncResolveNode
+shouldBe("function f() { const one = 1; ++one; return one; } f();", "1");
+shouldBe("function f() { const one = 1; return ++one; } f();", "2");
+
+// PreDecResolveNode
+shouldBe("function f() { const one = 1; --one; return one; } f();", "1");
+shouldBe("function f() { const one = 1; return --one; } f();", "0");
+
+// ReadModifyConstNode
+shouldBe("function f() { const one = 1; one += 2; return one; } f();", "1");
+shouldBe("function f() { const one = 1; return one += 2; } f();", "3");
+
+// AssignConstNode
+shouldBe("function f() { const one = 1; one = 2; return one; } f();", "1");
+shouldBe("function f() { const one = 1; return one = 2; } f();", "2");
+
+// PostIncResolveNode
+shouldBe("one++", "1");
+shouldBe("one", "1");
+
+// PostDecResolveNode
+shouldBe("one--", "1");
+shouldBe("one", "1");
+
+// PreIncResolveNode
+shouldBe("++one", "2");
+shouldBe("one", "1");
+
+// PreDecResolveNode
+shouldBe("--one", "0");
+shouldBe("one", "1");
+
+// ReadModifyConstNode
+shouldBe("one += 1", "2");
+shouldBe("one", "1");
+
+// AssignConstNode
+shouldBe("one = 2", "2");
+shouldBe("one", "1");
+
+var object = { inWith1: "RIGHT", inWith2: ""}
+with (object) {
+ const inWith1 = "WRONG";
+ const inWith2 = "RIGHT";
+ inWith2 = "WRONG";
+}
+shouldBe("object.inWith1", "'RIGHT'");
+shouldBe("inWith2", "'RIGHT'");
+
+shouldBe("(function(){ one = 2; return one; })()", "1")
+var f = function g() { g="FAIL"; return g; };
+shouldBe("f()", "f");
+
+shouldBe("const a;", "undefined");
+
+// Make sure we don't override properties placed on the global object
+var ranConstInitialiser = false;
+const bodyId = (ranConstInitialiser = true, "Const initialiser overwrote existing property");
+shouldBe("bodyId", "document.getElementById('bodyId')");
+shouldBeTrue("ranConstInitialiser");
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/garbage-collect-after-string-appends.js-disabled b/LayoutTests/fast/js/resources/garbage-collect-after-string-appends.js-disabled
new file mode 100644
index 0000000..1ec03ce
--- /dev/null
+++ b/LayoutTests/fast/js/resources/garbage-collect-after-string-appends.js-disabled
@@ -0,0 +1,39 @@
+description(
+"This test checks whether the GC collects after string appends."
+);
+
+// FIXME: This test appears to be highly tied to the details of how JS strings report memory
+// cost to the garbage collector. It should be improved to be less tied to these implementation details.
+// <https://bugs.webkit.org/show_bug.cgi?id=20871>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+if (window.GCController)
+ GCController.collect();
+
+
+// str has 150 chars in it (which is greater than the limit of the GC to ignore which I believe is at 128).
+var str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
+var count = 500;
+for (var i = 0; i < count; ++i) {
+ str += "b";
+}
+
+// str has 128 chars in it.
+str = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
+count = 10;
+for (var i = 0; i < count; ++i) {
+ str += str;
+}
+
+var jsObjCount = 0;
+if (window.GCController)
+ jsObjCount = GCController.getJSObjectCount();
+
+if (jsObjCount <= 500 && jsObjCount > 0)
+ testPassed("Garbage Collector triggered")
+else
+ testFailed("Garbage Collector NOT triggered. Number of JSObjects: " + jsObjCount);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js b/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js
new file mode 100644
index 0000000..880aed4
--- /dev/null
+++ b/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js
@@ -0,0 +1,95 @@
+description("Test to ensure correct behaviour of Object.getOwnPropertyDescriptor");
+
+function descriptorShouldBe(object, property, expected) {
+ var test = 'Object.getOwnPropertyDescriptor('+object+", "+property+')';
+ if ("writable" in expected) {
+ // shouldBe(test+'.writable', '' + expected.writable);
+ shouldBe(test+'.value', '' + expected.value);
+ shouldBeFalse(test+".hasOwnProperty('get')");
+ shouldBeFalse(test+".hasOwnProperty('set')");
+ } else {
+ shouldBe(test+'.get', '' + expected.get);
+ shouldBe(test+'.set', '' + expected.set);
+ shouldBeFalse(test+".hasOwnProperty('value')");
+ shouldBeFalse(test+".hasOwnProperty('writable')");
+ }
+ shouldBe(test+'.enumerable', '' + expected.enumerable);
+ shouldBe(test+'.configurable', '' + expected.configurable);
+}
+
+shouldBeUndefined("Object.getOwnPropertyDescriptor({}, 'undefinedProperty')");
+descriptorShouldBe("{definedProperty:'defined'}", "'definedProperty'", {writable: true, enumerable: true, configurable: true, value:'"defined"'});
+descriptorShouldBe("Array.prototype", "'concat'", {writable: true, enumerable: false, configurable: true, value:"Array.prototype.concat"});
+descriptorShouldBe("Date.prototype", "'toISOString'", {writable: true, enumerable: false, configurable: true, value: "Date.prototype.toISOString"});
+descriptorShouldBe("String.prototype", "'concat'", {writable: true, enumerable: false, configurable: true, value:"String.prototype.concat"});
+descriptorShouldBe("RegExp.prototype", "'exec'", {writable: true, enumerable: false, configurable: true, value:"RegExp.prototype.exec"});
+descriptorShouldBe("document.__proto__.__proto__", "'createElement'", {writable: true, enumerable: true, configurable: false, value:"document.createElement"});
+descriptorShouldBe("Number", "'NEGATIVE_INFINITY'", {writable: false, enumerable: false, configurable: false, value:"Number.NEGATIVE_INFINITY"});
+descriptorShouldBe("RegExp", "'$_'", {writable: true, enumerable: false, configurable: true, value:"RegExp.$_"});
+descriptorShouldBe("/a/g", "'global'", {writable: true, enumerable: false, configurable: false, value:true});
+descriptorShouldBe("Node", "'DOCUMENT_POSITION_DISCONNECTED'", {writable: false, enumerable: true, configurable: false, value:"Node.DOCUMENT_POSITION_DISCONNECTED"});
+descriptorShouldBe("Math", "'sin'", {writable: true, enumerable: false, configurable: true, value:"Math.sin"});
+descriptorShouldBe("[1,2,3]", "0", {writable: true, enumerable: true, configurable: true, value:"1"});
+descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, configurable: false, value:"3"});
+descriptorShouldBe("[1,2,3]", "'length'", {writable: true, enumerable: false, configurable: false, value:"3"});
+descriptorShouldBe("/(a)*/g.exec('a')", "0", {writable: true, enumerable: true, configurable: true, value:"'a'"});
+descriptorShouldBe("/(a)*/g.exec('a')", "'length'", {writable: true, enumerable: false, configurable: false, value:2});
+descriptorShouldBe("function(){}", "'length'", {writable: false, enumerable: false, configurable: false, value:0});
+descriptorShouldBe("Math.sin", "'length'", {writable: false, enumerable: false, configurable: false, value:1});
+descriptorShouldBe("Math.sin", "'name'", {writable: false, enumerable: false, configurable: false, value:"'sin'"});
+var global = this;
+descriptorShouldBe("global", "'global'", {writable: true, enumerable: true, configurable: false, value:"global"});
+descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, configurable: false, value:"global"});
+descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: true, configurable: false, value:"XMLHttpRequest"});
+descriptorShouldBe("global", "'length'", {writable: true, enumerable: true, configurable: false, value:"global.length"});
+descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurable: false, value:"global[0]"});
+descriptorShouldBe("document.getElementsByTagName('div')", "'length'", {writable: false, enumerable: true, configurable: false, value:"1"});
+descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByTagName('div')[0]"});
+descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByClassName('pass')[0]"});
+descriptorShouldBe("document.getElementsByClassName('pass')", "'length'", {writable: false, enumerable: true, configurable: false, value:"document.getElementsByClassName('pass').length"});
+var canvas = document.createElement("canvas");
+var canvasPixelArray = canvas.getContext("2d").createImageData(10,10).data;
+descriptorShouldBe("canvasPixelArray", "'length'", {writable: false, enumerable: true, configurable: false, value:"canvasPixelArray.length"});
+descriptorShouldBe("canvasPixelArray", "0", {writable: true, enumerable: true, configurable: false, value:"canvasPixelArray[0]"});
+var select = document.createElement("select");
+select.innerHTML = "<option>foo</option>";
+descriptorShouldBe("select", "'length'", {writable: false, enumerable: true, configurable: false, value:"select.length"});
+descriptorShouldBe("select", "0", {writable: true, enumerable: true, configurable: false, value:"select[0]"});
+
+var objectWithGetter = {};
+function getterFunc(){};
+objectWithGetter.__defineGetter__("getter", getterFunc);
+descriptorShouldBe("objectWithGetter", "'getter'", {"get": "getterFunc", "set": undefined, enumerable: true, configurable: true});
+var objectWithSetter = {};
+function setterFunc(){};
+objectWithSetter.__defineSetter__("setter", setterFunc);
+descriptorShouldBe("objectWithSetter", "'setter'", {"set": "setterFunc", "get": undefined, enumerable: true, configurable: true});
+var objectWithAccessor = {};
+objectWithAccessor.__defineSetter__("accessor", setterFunc);
+objectWithAccessor.__defineGetter__("accessor", getterFunc);
+descriptorShouldBe("objectWithAccessor", "'accessor'", {"set": "setterFunc", "get": "getterFunc", enumerable: true, configurable: true});
+
+shouldThrow("Object.getOwnPropertyDescriptor(null)");
+shouldThrow("Object.getOwnPropertyDescriptor(undefined)");
+shouldThrow("Object.getOwnPropertyDescriptor(1)");
+shouldThrow("Object.getOwnPropertyDescriptor('')");
+shouldThrow("Object.getOwnPropertyDescriptor(true)");
+shouldThrow("Object.getOwnPropertyDescriptor(false)");
+
+debug("Checking property ordering");
+var normalOrder = ["'value'", "'writable'", "'enumerable'", "'configurable'"];
+var accessorOrder = ["'get'", "'set'", "'enumerable'", "'configurable'"];
+var i = 0;
+for (var property in Object.getOwnPropertyDescriptor(Math, "sin"))
+ shouldBe('property', normalOrder[i++]);
+i = 0;
+for (var property in Object.getOwnPropertyDescriptor(objectWithGetter, "getter"))
+ shouldBe('property', accessorOrder[i++]);
+i = 0;
+for (var property in Object.getOwnPropertyDescriptor(objectWithSetter, "setter"))
+ shouldBe('property', accessorOrder[i++]);
+i = 0;
+for (var property in Object.getOwnPropertyDescriptor(objectWithAccessor, "accessor"))
+ shouldBe('property', accessorOrder[i++]);
+
+successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/instanceof-operator-dummy-worker.js b/LayoutTests/fast/js/resources/instanceof-operator-dummy-worker.js
new file mode 100644
index 0000000..9a65dba
--- /dev/null
+++ b/LayoutTests/fast/js/resources/instanceof-operator-dummy-worker.js
@@ -0,0 +1 @@
+// Empty JavaScript file.
diff --git a/LayoutTests/fast/js/resources/js-test-post-function.js b/LayoutTests/fast/js/resources/js-test-post-function.js
new file mode 100644
index 0000000..9be7bc0
--- /dev/null
+++ b/LayoutTests/fast/js/resources/js-test-post-function.js
@@ -0,0 +1,5 @@
+function isSuccessfullyParsed()
+{
+ shouldBeTrue("successfullyParsed");
+ debug('<br><span class="pass">TEST COMPLETE</span>');
+}
diff --git a/LayoutTests/fast/js/resources/js-test-post-n.js b/LayoutTests/fast/js/resources/js-test-post-n.js
new file mode 100644
index 0000000..d9bceae
--- /dev/null
+++ b/LayoutTests/fast/js/resources/js-test-post-n.js
@@ -0,0 +1,2 @@
+shouldBeUndefined("window.successfullyParsed");
+debug('<br><span class="pass">TEST COMPLETE</span>');
diff --git a/LayoutTests/fast/js/resources/js-test-post.js b/LayoutTests/fast/js/resources/js-test-post.js
new file mode 100644
index 0000000..6d8a68f
--- /dev/null
+++ b/LayoutTests/fast/js/resources/js-test-post.js
@@ -0,0 +1,2 @@
+shouldBeTrue("successfullyParsed");
+debug('<br /><span class="pass">TEST COMPLETE</span>');
diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js
new file mode 100644
index 0000000..b91812f
--- /dev/null
+++ b/LayoutTests/fast/js/resources/js-test-pre.js
@@ -0,0 +1,256 @@
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function description(msg)
+{
+ // For MSIE 6 compatibility
+ var span = document.createElement("span");
+ span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
+ var description = document.getElementById("description");
+ if (description.firstChild)
+ description.replaceChild(span, description.firstChild);
+ else
+ description.appendChild(span);
+}
+
+function debug(msg)
+{
+ var span = document.createElement("span");
+ document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
+ span.innerHTML = msg + '<br />';
+}
+
+function escapeHTML(text)
+{
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
+}
+
+function testPassed(msg)
+{
+ debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
+}
+
+function testFailed(msg)
+{
+ debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
+}
+
+function areArraysEqual(_a, _b)
+{
+ if (_a.length !== _b.length)
+ return false;
+ for (var i = 0; i < _a.length; i++)
+ if (_a[i] !== _b[i])
+ return false;
+ return true;
+}
+
+function isMinusZero(n)
+{
+ // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
+ // -Infinity instead of Infinity
+ return n === 0 && 1/n < 0;
+}
+
+function isResultCorrect(_actual, _expected)
+{
+ if (_expected === 0)
+ return _actual === _expected && (1/_actual) === (1/_expected);
+ if (_actual === _expected)
+ return true;
+ if (typeof(_expected) == "number" && isNaN(_expected))
+ return typeof(_actual) == "number" && isNaN(_actual);
+ if (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([]))
+ return areArraysEqual(_actual, _expected);
+ return false;
+}
+
+function stringify(v)
+{
+ if (v === 0 && 1/v < 0)
+ return "-0";
+ else return "" + v;
+}
+
+function evalAndLog(_a)
+{
+ if (typeof _a != "string")
+ debug("WARN: tryAndLog() expects a string argument");
+
+ // Log first in case things go horribly wrong or this causes a sync event.
+ debug(_a);
+
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ testFailed(_a + " threw exception " + e);
+ }
+}
+
+function shouldBe(_a, _b)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBe() expects string arguments");
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+
+ if (exception)
+ testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+ else if (isResultCorrect(_av, _bv))
+ testPassed(_a + " is " + _b);
+ else if (typeof(_av) == typeof(_bv))
+ testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+ else
+ testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+}
+
+function shouldBeTrue(_a) { shouldBe(_a, "true"); }
+function shouldBeFalse(_a) { shouldBe(_a, "false"); }
+function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
+function shouldBeNull(_a) { shouldBe(_a, "null"); }
+
+function shouldBeEqualToString(a, b)
+{
+ var unevaledString = '"' + b.replace(/"/g, "\"") + '"';
+ shouldBe(a, unevaledString);
+}
+
+function shouldEvaluateTo(actual, expected) {
+ // A general-purpose comparator. 'actual' should be a string to be
+ // evaluated, as for shouldBe(). 'expected' may be any type and will be
+ // used without being eval'ed.
+ if (expected == null) {
+ // Do this before the object test, since null is of type 'object'.
+ shouldBeNull(actual);
+ } else if (typeof expected == "undefined") {
+ shouldBeUndefined(actual);
+ } else if (typeof expected == "function") {
+ // All this fuss is to avoid the string-arg warning from shouldBe().
+ try {
+ actualValue = eval(actual);
+ } catch (e) {
+ testFailed("Evaluating " + actual + ": Threw exception " + e);
+ return;
+ }
+ shouldBe("'" + actualValue.toString().replace(/\n/g, "") + "'",
+ "'" + expected.toString().replace(/\n/g, "") + "'");
+ } else if (typeof expected == "object") {
+ shouldBeTrue(actual + " == '" + expected + "'");
+ } else if (typeof expected == "string") {
+ shouldBe(actual, expected);
+ } else if (typeof expected == "boolean") {
+ shouldBe("typeof " + actual, "'boolean'");
+ if (expected)
+ shouldBeTrue(actual);
+ else
+ shouldBeFalse(actual);
+ } else if (typeof expected == "number") {
+ shouldBe(actual, stringify(expected));
+ } else {
+ debug(expected + " is unknown type " + typeof expected);
+ shouldBeTrue(actual, "'" +expected.toString() + "'");
+ }
+}
+
+function shouldBeNonZero(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + " should be non-zero. Threw exception " + exception);
+ else if (_av != 0)
+ testPassed(_a + " is non-zero.");
+ else
+ testFailed(_a + " should be non-zero. Was " + _av);
+}
+
+function shouldBeNonNull(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + " should be non-null. Threw exception " + exception);
+ else if (_av != null)
+ testPassed(_a + " is non-null.");
+ else
+ testFailed(_a + " should be non-null. Was " + _av);
+}
+
+function shouldBeUndefined(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + " should be undefined. Threw exception " + exception);
+ else if (typeof _av == "undefined")
+ testPassed(_a + " is undefined.");
+ else
+ testFailed(_a + " should be undefined. Was " + _av);
+}
+
+
+function shouldThrow(_a, _e)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ var _ev;
+ if (_e)
+ _ev = eval(_e);
+
+ if (exception) {
+ if (typeof _e == "undefined" || exception == _ev)
+ testPassed(_a + " threw exception " + exception + ".");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
+ } else if (typeof _av == "undefined")
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
+}
+
+function gc() {
+ if (typeof GCController !== "undefined")
+ GCController.collect();
+ else {
+ function gcRec(n) {
+ if (n < 1)
+ return {};
+ var temp = {i: "ab" + i + (i / 100000)};
+ temp += "foo";
+ gcRec(n-1);
+ }
+ for (var i = 0; i < 1000; i++)
+ gcRec(10)
+ }
+}
diff --git a/LayoutTests/fast/js/resources/js-test-style.css b/LayoutTests/fast/js/resources/js-test-style.css
new file mode 100644
index 0000000..f12147c
--- /dev/null
+++ b/LayoutTests/fast/js/resources/js-test-style.css
@@ -0,0 +1,12 @@
+.pass {
+ font-weight: bold;
+ color: green;
+}
+.fail {
+ font-weight: bold;
+ color: red;
+}
+#console {
+ white-space: pre-wrap;
+ font-family: monospace;
+}
diff --git a/LayoutTests/fast/js/resources/json2-es5-compat.js b/LayoutTests/fast/js/resources/json2-es5-compat.js
new file mode 100644
index 0000000..047b3d4
--- /dev/null
+++ b/LayoutTests/fast/js/resources/json2-es5-compat.js
@@ -0,0 +1,477 @@
+/*
+ http://www.JSON.org/json2.js
+ 2009-04-16
+
+ Public Domain.
+
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+ See http://www.JSON.org/js.html
+
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
+
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
+
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
+
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or '&nbsp;'),
+ it contains the characters used to indent at each level.
+
+ This method produces a JSON text from a JavaScript value.
+
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the object holding the key.
+
+ For example, this would serialize Dates as ISO strings.
+
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
+
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
+
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
+
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
+
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
+
+ Example:
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
+
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
+
+
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
+
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
+
+ Example:
+
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
+
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
+
+
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+*/
+
+/*jslint evil: true */
+
+/*global JSON */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
+*/
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+if (!this.JSON) {
+ JSON = {};
+}
+(function () {
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ if (typeof Date.prototype.toJSON !== 'function') {
+
+ Date.prototype.toJSON = function (key) {
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+ }
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ?
+ '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' :
+ '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+// Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value && typeof value === 'object' &&
+ typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+// What happens next depends on the value's type.
+
+ if (value && ((typeof value) === "object")) {
+ if (value.constructor === String || value.constructor === Number || value.constructor === Boolean)
+ value = value.valueOf();
+ }
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+ return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+ case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+// Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+ v = partial.length === 0 ? '[]' :
+ gap ? '[\n' + gap +
+ partial.join(',\n' + gap) + '\n' +
+ mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ k = rep[i];
+ if (typeof k === 'string') {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' :
+ gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+ mind + '}' : '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+ if (typeof JSON.stringify !== 'function') {
+ JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+ }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+ if (typeof JSON.parse !== 'function') {
+ JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/.
+test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
+replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+ }
+}());
diff --git a/LayoutTests/fast/js/resources/lexical-lookup-in-function-constructor-child.html b/LayoutTests/fast/js/resources/lexical-lookup-in-function-constructor-child.html
new file mode 100644
index 0000000..ec10581
--- /dev/null
+++ b/LayoutTests/fast/js/resources/lexical-lookup-in-function-constructor-child.html
@@ -0,0 +1,10 @@
+<script>
+message = "SUCCESS";
+function doTest(para) {
+ var f = new Function('para', 'para.innerHTML = message;');
+ f(para);
+}
+</script>
+<body>
+</body>
+
diff --git a/LayoutTests/fast/js/resources/select-options-remove.js b/LayoutTests/fast/js/resources/select-options-remove.js
new file mode 100644
index 0000000..029acb4
--- /dev/null
+++ b/LayoutTests/fast/js/resources/select-options-remove.js
@@ -0,0 +1,232 @@
+description("This test checks the behavior of the remove() method on the select.options object.");
+
+var select1 = document.getElementById("select1");
+var value;
+
+debug("1.1 Remove (object) from empty Options");
+value = document.createElement("DIV");
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.2 Remove (string) from empty Options");
+value = "o";
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.3 Remove (float) from empty Options");
+value = 3.14;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.4 Remove (boolean) from empty Options");
+value = true;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.5 Remove (undefined) from empty Options");
+value = undefined;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.6 Remove (null) from empty Options");
+value = null;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.7 Remove (negative infinity) from empty Options");
+value = -1/0;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.8 Remove (NaN) from empty Options");
+value = 0/0;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.9 Remove (positive infinity) from empty Options");
+value = 1/0;
+shouldBe("select1.options.remove(value)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.10 Remove no args from empty Options");
+shouldBe("select1.options.remove()", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.11 Remove too many args from empty Options");
+shouldBe("select1.options.remove(0, 'foo')", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.12 Remove invalid index -2 from empty Options");
+shouldBe("select1.options.remove(-2)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.13 Remove invalid index -1 from empty Options");
+shouldBe("select1.options.remove(-1)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.14 Remove index 0 from empty Options");
+shouldBe("select1.options.remove(0)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+debug("1.15 Remove index 1 from empty Options");
+shouldBe("select1.options.remove(1)", "undefined");
+shouldBe("select1.options.length", "0");
+shouldBe("select1.selectedIndex", "-1");
+debug("");
+
+// ------------------------------------------------
+
+i = 0;
+var select2 = document.getElementById("select2");
+
+debug("2.1 Remove (object) from non-empty Options");
+value = document.createElement("DIV");
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "15");
+shouldBe("select2.selectedIndex", "13");
+shouldBe("select2.options[0].value", "'B'");
+debug("");
+
+debug("2.2 Remove (string) from non-empty Options");
+value = "o";
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "14");
+shouldBe("select2.selectedIndex", "12");
+shouldBe("select2.options[0].value", "'C'");
+debug("");
+
+debug("2.3 Remove (float) from non-empty Options");
+value = 3.14;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "13");
+shouldBe("select2.selectedIndex", "11");
+shouldBe("select2.options[3].value", "'G'");
+debug("");
+
+debug("2.4 Remove (boolean true) from non-empty Options");
+value = true;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "12");
+shouldBe("select2.selectedIndex", "10");
+shouldBe("select2.options[1].value", "'E'");
+debug("");
+
+debug("2.5 Remove (boolean false) from non-empty Options");
+value = false;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "11");
+shouldBe("select2.selectedIndex", "9");
+shouldBe("select2.options[1].value", "'G'");
+debug("");
+
+debug("2.6 Remove (undefined) from non-empty Options");
+value = undefined;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "10");
+shouldBe("select2.selectedIndex", "8");
+shouldBe("select2.options[0].value", "'G'");
+debug("");
+
+debug("2.7 Remove (null) from non-empty Options");
+value = null;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "9");
+shouldBe("select2.selectedIndex", "7");
+shouldBe("select2.options[0].value", "'H'");
+debug("");
+
+debug("2.8 Remove (negative infinity) from non-empty Options");
+value = -1/0;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "8");
+shouldBe("select2.selectedIndex", "6");
+shouldBe("select2.options[0].value", "'I'");
+debug("");
+
+debug("2.9 Remove (NaN) from non-empty Options");
+value = 0/0;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "7");
+shouldBe("select2.selectedIndex", "5");
+shouldBe("select2.options[0].value", "'J'");
+debug("");
+
+debug("2.10 Remove (positive infinity) from non-empty Options");
+value = 1/0;
+shouldBe("select2.options.remove(value)", "undefined");
+shouldBe("select2.options.length", "6");
+shouldBe("select2.selectedIndex", "4");
+shouldBe("select2.options[0].value", "'K'");
+debug("");
+
+debug("2.11 Remove no args from non-empty Options");
+shouldBe("select2.options.remove()", "undefined");
+shouldBe("select2.options.length", "5");
+shouldBe("select2.selectedIndex", "3");
+shouldBe("select2.options[0].value", "'L'");
+debug("");
+
+debug("2.12 Remove too many args from non-empty Options");
+shouldBe("select2.options.remove(0, 'foo')", "undefined");
+shouldBe("select2.options.length", "4");
+shouldBe("select2.selectedIndex", "2");
+shouldBe("select2.options[0].value", "'M'");
+debug("");
+
+debug("2.13 Remove invalid index -2 from non-empty Options");
+shouldBe("select2.options.remove(-2)", "undefined");
+shouldBe("select2.options.length", "4");
+shouldBe("select2.selectedIndex", "2");
+shouldBe("select2.options[2].value", "'O'");
+debug("");
+
+debug("2.14 Remove invalid index -1 from non-empty Options");
+shouldBe("select2.options.remove(-1)", "undefined");
+shouldBe("select2.options.length", "4");
+shouldBe("select2.selectedIndex", "2");
+shouldBe("select2.options[3].value", "'P'");
+debug("");
+
+debug("2.15 Remove index 0 from non-empty Options");
+shouldBe("select2.options.remove(0)", "undefined");
+shouldBe("select2.options.length", "3");
+shouldBe("select2.selectedIndex", "1");
+shouldBe("select2.options[0].value", "'N'");
+debug("");
+
+debug("2.16 Remove index 1 from non-empty Options");
+shouldBe("select2.options.remove(1)", "undefined");
+shouldBe("select2.options.length", "2");
+shouldBe("select2.selectedIndex", "0");
+shouldBe("select2.options[1].value", "'P'");
+debug("");
+
+successfullyParsed = true;
diff --git a/LayoutTests/fast/js/resources/standalone-post.js b/LayoutTests/fast/js/resources/standalone-post.js
new file mode 100644
index 0000000..4b8a56d
--- /dev/null
+++ b/LayoutTests/fast/js/resources/standalone-post.js
@@ -0,0 +1,2 @@
+shouldBeTrue("successfullyParsed");
+debug("\nTEST COMPLETE\n");
diff --git a/LayoutTests/fast/js/resources/standalone-pre.js b/LayoutTests/fast/js/resources/standalone-pre.js
new file mode 100644
index 0000000..692f1c1
--- /dev/null
+++ b/LayoutTests/fast/js/resources/standalone-pre.js
@@ -0,0 +1,141 @@
+function description(msg)
+{
+ print(msg);
+ print("\nOn success, you will see a series of \"PASS\" messages, followed by \"TEST COMPLETE\".\n");
+ print();
+}
+
+function debug(msg)
+{
+ print(msg);
+}
+
+function escapeString(text)
+{
+ return text.replace(/\0/g, "");
+}
+
+function testPassed(msg)
+{
+ print("PASS", escapeString(msg));
+}
+
+function testFailed(msg)
+{
+ print("FAIL", escapeString(msg));
+}
+
+function areArraysEqual(_a, _b)
+{
+ if (_a.length !== _b.length)
+ return false;
+ for (var i = 0; i < _a.length; i++)
+ if (_a[i] !== _b[i])
+ return false;
+ return true;
+}
+
+function isMinusZero(n)
+{
+ // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
+ // -Infinity instead of Infinity
+ return n === 0 && 1/n < 0;
+}
+
+function isResultCorrect(_actual, _expected)
+{
+ if (_expected === 0)
+ return _actual === _expected && (1/_actual) === (1/_expected);
+ if (_actual === _expected)
+ return true;
+ if (typeof(_expected) == "number" && isNaN(_expected))
+ return typeof(_actual) == "number" && isNaN(_actual);
+ if (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([]))
+ return areArraysEqual(_actual, _expected);
+ return false;
+}
+
+function stringify(v)
+{
+ if (v === 0 && 1/v < 0)
+ return "-0";
+ else return "" + v;
+}
+
+function shouldBe(_a, _b)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ debug("WARN: shouldBe() expects string arguments");
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+
+ if (exception)
+ testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+ else if (isResultCorrect(_av, _bv))
+ testPassed(_a + " is " + _b);
+ else if (typeof(_av) == typeof(_bv))
+ testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+ else
+ testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+}
+
+function shouldBeTrue(_a) { shouldBe(_a, "true"); }
+function shouldBeFalse(_a) { shouldBe(_a, "false"); }
+function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
+function shouldBeNull(_a) { shouldBe(_a, "null"); }
+
+function shouldBeEqualToString(a, b)
+{
+ var unevaledString = '"' + b.replace(/"/g, "\"") + '"';
+ shouldBe(a, unevaledString);
+}
+
+function shouldBeUndefined(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + " should be undefined. Threw exception " + exception);
+ else if (typeof _av == "undefined")
+ testPassed(_a + " is undefined.");
+ else
+ testFailed(_a + " should be undefined. Was " + _av);
+}
+
+
+function shouldThrow(_a, _e)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ var _ev;
+ if (_e)
+ _ev = eval(_e);
+
+ if (exception) {
+ if (typeof _e == "undefined" || exception == _ev)
+ testPassed(_a + " threw exception " + exception + ".");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
+ } else if (typeof _av == "undefined")
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
+ else
+ testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
+}
diff --git a/LayoutTests/fast/js/resources/string-concatenate-outofmemory.js b/LayoutTests/fast/js/resources/string-concatenate-outofmemory.js
new file mode 100644
index 0000000..db962e8
--- /dev/null
+++ b/LayoutTests/fast/js/resources/string-concatenate-outofmemory.js
@@ -0,0 +1,52 @@
+description(
+'This test checks if repeated string concatenation causes an exception (and not a crash). From WebKit Bug <a href="http://bugs.webkit.org/show_bug.cgi?id=11131">Repeated string concatenation results in OOM crash</a>.'
+);
+
+shouldThrow('s = "a"; while (1) { s += s; }', '"Error: Out of memory"'); // Expand at end of string
+shouldThrow('s = "a"; while (1) { s += ("a" + s); }', '"Error: Out of memory"'); // Expand at beginning of string
+shouldThrow('s = "a"; while (1) { s = [s, s].join(); }', '"Error: Out of memory"'); // Expand using UString::append.
+
+debug('');
+debug(
+'We also verify that the the string is stil functional after the out of memory exception is raised. In <a href="rdar://problem/5352887">rdar://problem/5352887</a>, accessing the string after the exception would crash.'
+);
+
+function ensureStringIsUsable(testName, stringName, str) {
+ str[str.length - 1];
+ try { [str, str].join(str); } catch (o) { }
+ try { "a" + str; } catch (o) { }
+ try { str + "a"; } catch (o) { }
+ debug('PASS: String ' + stringName + ' was functional after ' + testName + ' raised out of memory exception.');
+}
+
+var s = "a";
+try {
+ while (1)
+ s += s; // This will expand the string at the end using UString::expandCapacity
+} catch (o) {
+ ensureStringIsUsable('expandCapacity', 's', s);
+}
+
+s = "a";
+var t = "";
+try {
+ while (1) {
+ t = "a" + s;
+ s += t; // This will expand the string at the beginning using UString::expandPreCapacity
+ }
+} catch (o) {
+ // Ensure both strings involved are unharmed
+ ensureStringIsUsable('expandPreCapacity', 's', s);
+ ensureStringIsUsable('expandPreCapacity', 't', t);
+}
+delete t;
+
+s = "a";
+try {
+ while (1)
+ s = [s, s].join(); // This will expand the string using UString::append.
+} catch (o) {
+ ensureStringIsUsable('append', 's', s);
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/http/conf/apache2-debian-httpd.conf b/LayoutTests/http/conf/apache2-debian-httpd.conf
new file mode 100644
index 0000000..03aa9c8
--- /dev/null
+++ b/LayoutTests/http/conf/apache2-debian-httpd.conf
@@ -0,0 +1,677 @@
+##
+## httpd.conf -- Apache HTTP server configuration file
+##
+
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file. It contains the
+# configuration directives that give the server its instructions.
+# See <URL:http://httpd.apache.org/docs/> for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do. They're here only as hints or reminders. If you are unsure
+# consult the online docs. You have been warned.
+#
+# After this file is processed, the server will look for and process
+# /private/etc/apache2/srm.conf and then /private/etc/apache2/access.conf
+# unless you have overridden these with ResourceConfig and/or
+# AccessConfig directives here.
+#
+# The configuration directives are grouped into three basic sections:
+# 1. Directives that control the operation of the Apache server process as a
+# whole (the 'global environment').
+# 2. Directives that define the parameters of the 'main' or 'default' server,
+# which responds to requests that aren't handled by a virtual host.
+# These directives also provide default values for the settings
+# of all virtual hosts.
+# 3. Settings for virtual hosts, which allow Web requests to be sent to
+# different IP addresses or hostnames and have them handled by the
+# same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path. If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
+# with ServerRoot set to "/usr/local/apache" will be interpreted by the
+# server as "/usr/local/apache/logs/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE! If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation
+# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+ServerRoot "/usr"
+
+#
+# The LockFile directive sets the path to the lockfile used when Apache
+# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
+# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
+# its default value. The main reason for changing it is if the logs
+# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
+# DISK. The PID of the main server process is automatically appended to
+# the filename.
+#
+LockFile "/tmp/WebKit/httpd.lock"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+PidFile "/tmp/WebKit/httpd.pid"
+
+#
+# ScoreBoardFile: File used to store internal server process information.
+# Not all architectures require this. But if yours does (you'll know because
+# this file will be created when you run Apache) then you *must* ensure that
+# no two invocations of Apache share the same scoreboard file.
+#
+ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 15
+
+#
+# Server-pool size regulation. Rather than making you guess how many
+# server processes you need, Apache dynamically adapts to the load it
+# sees --- that is, it tries to maintain enough server processes to
+# handle the current load, plus a few spare servers to handle transient
+# load spikes (e.g., multiple simultaneous requests from a single
+# Netscape browser).
+#
+# It does this by periodically checking how many servers are waiting
+# for a request. If there are fewer than MinSpareServers, it creates
+# a new spare. If there are more than MaxSpareServers, some of the
+# spares die off. The default values are probably OK for most sites.
+#
+MinSpareServers 1
+MaxSpareServers 5
+
+#
+# Number of servers to start initially --- should be a reasonable ballpark
+# figure.
+#
+StartServers 1
+
+#
+# Limit on total number of servers running, i.e., limit on the number
+# of clients who can simultaneously connect --- if this limit is ever
+# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
+# It is intended mainly as a brake to keep a runaway server from taking
+# the system with it as it spirals down...
+#
+MaxClients 150
+
+#
+# MaxRequestsPerChild: the number of requests each child process is
+# allowed to process before the child dies. The child will exit so
+# as to avoid problems after prolonged use when Apache (and maybe the
+# libraries it uses) leak memory or other resources. On most systems, this
+# isn't really needed, but a few (such as Solaris) do have notable leaks
+# in the libraries. For these platforms, set to something like 10000
+# or so; a setting of 0 means unlimited.
+#
+# NOTE: This value does not include keepalive requests after the initial
+# request per connection. For example, if a child process handles
+# an initial request and 10 subsequent "keptalive" requests, it
+# would only count as 1 request towards this limit.
+#
+MaxRequestsPerChild 100000
+
+#
+# Listen: Allows you to bind Apache to specific IP addresses and/or
+# ports, instead of the default. See also the <VirtualHost>
+# directive.
+#
+# Configured from the httpd command line for WebKit layout tests.
+# Port 8443 is hard-coded as it is needed for the HTTPS configuration later on.
+#
+#Listen 3000
+Listen 127.0.0.1:8080
+Listen 127.0.0.1:8443
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+# To be able to use the functionality of a module which was built as a DSO you
+# have to place corresponding `LoadModule' lines at this location so the
+# directives contained in it are actually available _before_ they are used.
+# Please read the file http://httpd.apache.org/docs/dso.html for more
+# details about the DSO mechanism and run `httpd -l' for the list of already
+# built-in (statically linked and thus always available) modules in your httpd
+# binary.
+#
+# Note: The order in which modules are loaded is important. Don't change
+# the order below without expert advice.
+#
+# Example:
+# LoadModule foo_module libexec/mod_foo.so
+#LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
+#LoadModule env_module /usr/lib/apache2/modules/mod_env.so
+#LoadModule log_config_module /usr/lib/apache2/modules/mod_log_config.so
+#LoadModule mime_magic_module /usr/lib/apache2/modules/mod_mime_magic.so
+LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
+LoadModule negotiation_module /usr/lib/apache2/modules/mod_negotiation.so
+#LoadModule status_module /usr/lib/apache2/modules/mod_status.so
+#LoadModule info_module /usr/lib/apache2/modules/mod_info.so
+LoadModule include_module /usr/lib/apache2/modules/mod_include.so
+#LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
+#LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
+LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
+LoadModule asis_module /usr/lib/apache2/modules/mod_asis.so
+LoadModule imagemap_module /usr/lib/apache2/modules/mod_imagemap.so
+LoadModule actions_module /usr/lib/apache2/modules/mod_actions.so
+#LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so
+#LoadModule userdir_module /usr/lib/apache2/modules/mod_userdir.so
+LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
+LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
+LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so
+#LoadModule auth_module /usr/lib/apache2/modules/mod_auth_basic.so
+#LoadModule anon_auth_module /usr/lib/apache2/modules/mod_auth_anon.so
+#LoadModule dbm_auth_module /usr/lib/apache2/modules/mod_auth_dbm.so
+#LoadModule digest_module /usr/lib/apache2/modules/mod_digest.so
+#LoadModule proxy_module /usr/lib/apache2/modules/libproxy.so
+#LoadModule cern_meta_module /usr/lib/apache2/modules/mod_cern_meta.so
+#LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so
+LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
+#LoadModule usertrack_module /usr/lib/apache2/modules/mod_usertrack.so
+#LoadModule log_forensic_module /usr/lib/apache2/modules/mod_log_forensic.so
+#LoadModule unique_id_module /usr/lib/apache2/modules/mod_unique_id.so
+#LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
+#LoadModule dav_module /usr/lib/apache2/modules/libdav.so
+LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
+#LoadModule perl_module /usr/lib/apache2/modules/libperl.so
+LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
+#LoadModule hfs_apple_module /usr/lib/apache2/modules/mod_hfs_apple.so
+#LoadModule bonjour_module /usr/lib/apache2/modules/mod_bonjour.so
+
+### Section 2: 'Main' server configuration
+#
+# The directives in this section set up the values used by the 'main'
+# server, which responds to any requests that aren't handled by a
+# <VirtualHost> definition. These values also provide defaults for
+# any <VirtualHost> containers you may define later in the file.
+#
+# All of these directives may appear inside <VirtualHost> containers,
+# in which case these default settings will be overridden for the
+# virtual host being defined.
+#
+
+#
+# ServerName allows you to set a host name which is sent back to clients for
+# your server if it's different than the one the program would get (i.e., use
+# "www" instead of the host's real name).
+#
+# Note: You cannot just invent host names and hope they work. The name you
+# define here must be a valid DNS name for your host. If you don't understand
+# this, ask your network administrator.
+# If your host doesn't have a registered DNS name, enter its IP address here.
+# You will have to access it by its address (e.g., http://123.45.67.89/)
+# anyway, and this will make redirections work in a sensible way.
+#
+# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
+# machine always knows itself by this address. If you use Apache strictly for
+# local testing and development, you may use 127.0.0.1 as the server name.
+#
+ServerName 127.0.0.1
+
+#
+# DocumentRoot: The directory out of which you will serve your
+# documents. By default, all requests are taken from this directory, but
+# symbolic links and aliases may be used to point to other locations.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#DocumentRoot "/Library/WebServer/Documents"
+
+#
+# Each directory to which Apache has access, can be configured with respect
+# to which services and features are allowed and/or disabled in that
+# directory (and its subdirectories).
+#
+<Directory />
+#
+# This may also be "None", "All", or any combination of "Indexes",
+# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
+#
+# Note that "MultiViews" must be named *explicitly* --- "Options All"
+# doesn't give it to you.
+#
+ Options Indexes FollowSymLinks MultiViews ExecCGI Includes
+
+#
+# This controls which options the .htaccess files in directories can
+# override. Can also be "All", or any combination of "Options", "FileInfo",
+# "AuthConfig", and "Limit"
+#
+ AllowOverride All
+
+#
+# Controls who can get stuff from this server.
+#
+ Order allow,deny
+ Allow from all
+</Directory>
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for access control information.
+#
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess files from being viewed by
+# Web clients. Since .htaccess files often contain authorization
+# information, access is disallowed for security reasons. Comment
+# these lines out if you want Web visitors to see the contents of
+# .htaccess files. If you change the AccessFileName directive above,
+# be sure to make the corresponding changes here.
+#
+# Also, folks tend to use names such as .htpasswd for password
+# files, so this will protect those as well.
+#
+<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+#
+# Apple specific filesystem protection.
+#
+
+<Files "rsrc">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+<Directory ~ ".*\.\.namedfork">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Directory>
+
+#
+# CacheNegotiatedDocs: By default, Apache sends "Pragma: no-cache" with each
+# document that was negotiated on the basis of content. This asks proxy
+# servers not to cache the document. Uncommenting the following line disables
+# this behavior, and proxies will be allowed to cache the documents.
+#
+#CacheNegotiatedDocs
+
+#
+# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
+# Apache needs to construct a self-referencing URL (a URL that refers back
+# to the server the response is coming from) it will use ServerName and
+# Port to form a "canonical" name. With this setting off, Apache will
+# use the hostname:port that the client supplied, when possible. This
+# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
+#
+UseCanonicalName On
+
+#
+# TypesConfig describes where the mime.types file (or equivalent) is
+# to be found.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#
+#<IfModule mod_mime.c>
+# TypesConfig /private/etc/apache2/mime.types
+#</IfModule>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+#
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#ErrorLog "/tmp/layout-test-results/error_log"
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+#
+# The location and format of the access logfile (Common Logfile Format).
+# If you do not define any access logfiles within a <VirtualHost>
+# container, they will be logged here. Contrariwise, if you *do*
+# define per-<VirtualHost> access logfiles, transactions will be
+# logged therein and *not* in this file.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#CustomLog "/tmp/layout-test-results/access_log" common
+
+#
+# If you prefer a single logfile with access, agent, and referer information
+# (Combined Logfile Format) you can use the following directive.
+#
+#CustomLog "/tmp/layout-test-results/access_log" combined
+
+#
+# Optionally add a line containing the server version and virtual host
+# name to server-generated pages (error documents, FTP directory listings,
+# mod_status and mod_info output etc., but not CGI generated documents).
+# Set to "EMail" to also include a mailto: link to the ServerAdmin.
+# Set to one of: On | Off | EMail
+#
+ServerSignature On
+
+#
+# Aliases: Add here as many aliases as you need (with no limit). The format is
+# Alias fakename realname
+#
+<IfModule mod_alias.c>
+</IfModule>
+# End of aliases.
+
+#
+# Redirect allows you to tell clients about documents which used to exist in
+# your server's namespace, but do not anymore. This allows you to tell the
+# clients where to look for the relocated document.
+# Format: Redirect old-URI new-URL
+#
+
+#
+# Document types.
+#
+<IfModule mod_mime.c>
+
+ #
+ # AddLanguage allows you to specify the language of a document. You can
+ # then use content negotiation to give a browser a file in a language
+ # it can understand.
+ #
+ # Note 1: The suffix does not have to be the same as the language
+ # keyword --- those with documents in Polish (whose net-standard
+ # language code is pl) may wish to use "AddLanguage pl .po" to
+ # avoid the ambiguity with the common suffix for perl scripts.
+ #
+ # Note 2: The example entries below illustrate that in quite
+ # some cases the two character 'Language' abbreviation is not
+ # identical to the two character 'Country' code for its country,
+ # E.g. 'Danmark/dk' versus 'Danish/da'.
+ #
+ # Note 3: In the case of 'ltz' we violate the RFC by using a three char
+ # specifier. But there is 'work in progress' to fix this and get
+ # the reference data for rfc1766 cleaned up.
+ #
+ # Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
+ # French (fr) - German (de) - Greek-Modern (el)
+ # Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)
+ # Portugese (pt) - Luxembourgeois* (ltz)
+ # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
+ # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
+ # Russian (ru)
+ #
+ AddLanguage da .dk
+ AddLanguage nl .nl
+ AddLanguage en .en
+ AddLanguage et .ee
+ AddLanguage fr .fr
+ AddLanguage de .de
+ AddLanguage el .el
+ AddLanguage he .he
+ AddCharset ISO-8859-8 .iso8859-8
+ AddLanguage it .it
+ AddLanguage ja .ja
+ AddCharset ISO-2022-JP .jis
+ AddLanguage kr .kr
+ AddCharset ISO-2022-KR .iso-kr
+ AddLanguage nn .nn
+ AddLanguage no .no
+ AddLanguage pl .po
+ AddCharset ISO-8859-2 .iso-pl
+ AddLanguage pt .pt
+ AddLanguage pt-br .pt-br
+ AddLanguage ltz .lu
+ AddLanguage ca .ca
+ AddLanguage es .es
+ AddLanguage sv .sv
+ AddLanguage cs .cz .cs
+ AddLanguage ru .ru
+ AddLanguage zh-TW .zh-tw
+ AddCharset Big5 .Big5 .big5
+ AddCharset WINDOWS-1251 .cp-1251
+ AddCharset CP866 .cp866
+ AddCharset ISO-8859-5 .iso-ru
+ AddCharset KOI8-R .koi8-r
+ AddCharset UCS-2 .ucs2
+ AddCharset UCS-4 .ucs4
+ AddCharset UTF-8 .utf8
+
+ # LanguagePriority allows you to give precedence to some languages
+ # in case of a tie during content negotiation.
+ #
+ # Just list the languages in decreasing order of preference. We have
+ # more or less alphabetized them here. You probably want to change this.
+ #
+ <IfModule mod_negotiation.c>
+ LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
+ </IfModule>
+
+ #
+ # AddType allows you to tweak mime.types without actually editing it, or to
+ # make certain files to be certain types.
+ #
+ AddType application/x-tar .tgz
+
+ #
+ # AddEncoding allows you to have certain browsers uncompress
+ # information on the fly. Note: Not all browsers support this.
+ # Despite the name similarity, the following Add* directives have nothing
+ # to do with the FancyIndexing customization directives above.
+ #
+ AddEncoding x-compress .Z
+ AddEncoding x-gzip .gz .tgz
+ #
+ # If the AddEncoding directives above are commented-out, then you
+ # probably should define those extensions to indicate media types:
+ #
+ #AddType application/x-compress .Z
+ #AddType application/x-gzip .gz .tgz
+
+ #
+ # AddHandler allows you to map certain file extensions to "handlers",
+ # actions unrelated to filetype. These can be either built into the server
+ # or added with the Action command (see below)
+ #
+ # If you want to use server side includes, or CGI outside
+ # ScriptAliased directories, uncomment the following lines.
+ #
+ # To use CGI scripts:
+ #
+ AddHandler cgi-script .cgi .pl
+
+ #
+ # To use server-parsed HTML files
+ #
+ AddType text/html .shtml
+ AddHandler server-parsed .shtml
+
+ #
+ # Uncomment the following line to enable Apache's send-asis HTTP file
+ # feature
+ #
+ AddHandler send-as-is asis
+
+ #
+ # If you wish to use server-parsed imagemap files, use
+ #
+ #AddHandler imap-file map
+
+ #
+ # To enable type maps, you might want to use
+ #
+ #AddHandler type-map var
+
+</IfModule>
+# End of document types.
+
+#
+# Action lets you define media types that will execute a script whenever
+# a matching file is called. This eliminates the need for repeated URL
+# pathnames for oft-used CGI file processors.
+# Format: Action media/type /cgi-script/location
+# Format: Action handler-name /cgi-script/location
+#
+
+#
+# MetaDir: specifies the name of the directory in which Apache can find
+# meta information files. These files contain additional HTTP headers
+# to include when sending the document
+#
+#MetaDir .web
+
+#
+# MetaSuffix: specifies the file name suffix for the file containing the
+# meta information.
+#
+#MetaSuffix .meta
+
+#
+# Customizable error response (Apache style)
+# these come in three flavors
+#
+# 1) plain text
+#ErrorDocument 500 "The server made a boo boo.
+# n.b. the single leading (") marks it as text, it does not get output
+#
+# 2) local redirects
+#ErrorDocument 404 /missing.html
+# to redirect to local URL /missing.html
+#ErrorDocument 404 /cgi-bin/missing_handler.pl
+# N.B.: You can redirect to a script or a document using server-side-includes.
+#
+# 3) external redirects
+#ErrorDocument 402 http://some.other-server.com/subscription_info.html
+# N.B.: Many of the environment variables associated with the original
+# request will *not* be available to such a script.
+
+#
+# Proxy Server directives. Uncomment the following lines to
+# enable the proxy server:
+#
+#<IfModule mod_proxy.c>
+# ProxyRequests On
+
+# <Directory proxy:*>
+# Order deny,allow
+# Deny from all
+# Allow from .your-domain.com
+# </Directory>
+
+ #
+ # Enable/disable the handling of HTTP/1.1 "Via:" headers.
+ # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
+ # Set to one of: Off | On | Full | Block
+ #
+# ProxyVia On
+
+ #
+ # To enable the cache as well, edit and uncomment the following lines:
+ # (no cacheing without CacheRoot)
+ #
+# CacheRoot "/private/var/run/proxy"
+# CacheSize 5
+# CacheGcInterval 4
+# CacheMaxExpire 24
+# CacheLastModifiedFactor 0.1
+# CacheDefaultExpire 1
+# NoCache a-domain.com another-domain.edu joes.garage-sale.com
+
+#</IfModule>
+# End of proxy directives.
+
+
+<IfModule mod_php5.c>
+ # If php is turned on, we repsect .php and .phps files.
+ AddType application/x-httpd-php .php
+ AddType application/x-httpd-php .bat
+ AddType application/x-httpd-php-source .phps
+
+ # Since most users will want index.php to work we
+ # also automatically enable index.php
+ <IfModule mod_dir.c>
+ DirectoryIndex index.html index.php
+ </IfModule>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_METHOD} ^TRACE
+ RewriteRule .* - [F]
+</IfModule>
+
+<VirtualHost 127.0.0.1:8443>
+ ServerName 127.0.0.1
+ SSLEngine On
+</VirtualHost>
diff --git a/LayoutTests/http/conf/apache2-httpd.conf b/LayoutTests/http/conf/apache2-httpd.conf
new file mode 100644
index 0000000..980e4e2
--- /dev/null
+++ b/LayoutTests/http/conf/apache2-httpd.conf
@@ -0,0 +1,702 @@
+##
+## httpd.conf -- Apache HTTP server configuration file
+##
+
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file. It contains the
+# configuration directives that give the server its instructions.
+# See <URL:http://httpd.apache.org/docs/> for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do. They're here only as hints or reminders. If you are unsure
+# consult the online docs. You have been warned.
+#
+# After this file is processed, the server will look for and process
+# /private/etc/apache2/srm.conf and then /private/etc/apache2/access.conf
+# unless you have overridden these with ResourceConfig and/or
+# AccessConfig directives here.
+#
+# The configuration directives are grouped into three basic sections:
+# 1. Directives that control the operation of the Apache server process as a
+# whole (the 'global environment').
+# 2. Directives that define the parameters of the 'main' or 'default' server,
+# which responds to requests that aren't handled by a virtual host.
+# These directives also provide default values for the settings
+# of all virtual hosts.
+# 3. Settings for virtual hosts, which allow Web requests to be sent to
+# different IP addresses or hostnames and have them handled by the
+# same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path. If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
+# with ServerRoot set to "/usr/local/apache" will be interpreted by the
+# server as "/usr/local/apache/logs/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE! If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation
+# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+ServerRoot "/usr"
+
+#
+# The LockFile directive sets the path to the lockfile used when Apache
+# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
+# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
+# its default value. The main reason for changing it is if the logs
+# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
+# DISK. The PID of the main server process is automatically appended to
+# the filename.
+#
+LockFile "/tmp/WebKit/httpd.lock"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+PidFile "/tmp/WebKit/httpd.pid"
+
+#
+# ScoreBoardFile: File used to store internal server process information.
+# Not all architectures require this. But if yours does (you'll know because
+# this file will be created when you run Apache) then you *must* ensure that
+# no two invocations of Apache share the same scoreboard file.
+#
+ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 15
+
+#
+# Server-pool size regulation. Rather than making you guess how many
+# server processes you need, Apache dynamically adapts to the load it
+# sees --- that is, it tries to maintain enough server processes to
+# handle the current load, plus a few spare servers to handle transient
+# load spikes (e.g., multiple simultaneous requests from a single
+# Netscape browser).
+#
+# It does this by periodically checking how many servers are waiting
+# for a request. If there are fewer than MinSpareServers, it creates
+# a new spare. If there are more than MaxSpareServers, some of the
+# spares die off. The default values are probably OK for most sites.
+#
+MinSpareServers 1
+MaxSpareServers 5
+
+#
+# Number of servers to start initially --- should be a reasonable ballpark
+# figure.
+#
+StartServers 1
+
+#
+# Limit on total number of servers running, i.e., limit on the number
+# of clients who can simultaneously connect --- if this limit is ever
+# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
+# It is intended mainly as a brake to keep a runaway server from taking
+# the system with it as it spirals down...
+#
+MaxClients 150
+
+#
+# MaxRequestsPerChild: the number of requests each child process is
+# allowed to process before the child dies. The child will exit so
+# as to avoid problems after prolonged use when Apache (and maybe the
+# libraries it uses) leak memory or other resources. On most systems, this
+# isn't really needed, but a few (such as Solaris) do have notable leaks
+# in the libraries. For these platforms, set to something like 10000
+# or so; a setting of 0 means unlimited.
+#
+# NOTE: This value does not include keepalive requests after the initial
+# request per connection. For example, if a child process handles
+# an initial request and 10 subsequent "keptalive" requests, it
+# would only count as 1 request towards this limit.
+#
+MaxRequestsPerChild 100000
+
+#
+# Listen: Allows you to bind Apache to specific IP addresses and/or
+# ports, instead of the default. See also the <VirtualHost>
+# directive.
+#
+# Configured from the httpd command line for WebKit layout tests.
+# Port 8443 is hard-coded as it is needed for the HTTPS configuration later on.
+#
+#Listen 3000
+Listen 127.0.0.1:8080
+Listen 127.0.0.1:8443
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+# To be able to use the functionality of a module which was built as a DSO you
+# have to place corresponding `LoadModule' lines at this location so the
+# directives contained in it are actually available _before_ they are used.
+# Please read the file http://httpd.apache.org/docs/dso.html for more
+# details about the DSO mechanism and run `httpd -l' for the list of already
+# built-in (statically linked and thus always available) modules in your httpd
+# binary.
+#
+# Note: The order in which modules are loaded is important. Don't change
+# the order below without expert advice.
+#
+# Example:
+# LoadModule foo_module libexec/mod_foo.so
+#LoadModule authn_file_module libexec/apache2/mod_authn_file.so
+#LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
+#LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
+#LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
+#LoadModule authn_default_module libexec/apache2/mod_authn_default.so
+LoadModule authz_host_module libexec/apache2/mod_authz_host.so
+#LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
+#LoadModule authz_user_module libexec/apache2/mod_authz_user.so
+#LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
+#LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
+#LoadModule authz_default_module libexec/apache2/mod_authz_default.so
+#LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
+#LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
+#LoadModule cache_module libexec/apache2/mod_cache.so
+#LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
+#LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
+#LoadModule dbd_module libexec/apache2/mod_dbd.so
+#LoadModule dumpio_module libexec/apache2/mod_dumpio.so
+#LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
+LoadModule include_module libexec/apache2/mod_include.so
+#LoadModule filter_module libexec/apache2/mod_filter.so
+#LoadModule substitute_module libexec/apache2/mod_substitute.so
+#LoadModule deflate_module libexec/apache2/mod_deflate.so
+LoadModule log_config_module libexec/apache2/mod_log_config.so
+#LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
+#LoadModule logio_module libexec/apache2/mod_logio.so
+#LoadModule env_module libexec/apache2/mod_env.so
+#LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
+#LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so
+#LoadModule expires_module libexec/apache2/mod_expires.so
+LoadModule headers_module libexec/apache2/mod_headers.so
+#LoadModule ident_module libexec/apache2/mod_ident.so
+#LoadModule usertrack_module libexec/apache2/mod_usertrack.so
+#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
+#LoadModule setenvif_module libexec/apache2/mod_setenvif.so
+#LoadModule version_module libexec/apache2/mod_version.so
+#LoadModule proxy_module libexec/apache2/mod_proxy.so
+#LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
+#LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
+#LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
+#LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
+#LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
+LoadModule ssl_module libexec/apache2/mod_ssl.so
+LoadModule mime_module libexec/apache2/mod_mime.so
+#LoadModule dav_module libexec/apache2/mod_dav.so
+#LoadModule status_module libexec/apache2/mod_status.so
+#LoadModule autoindex_module libexec/apache2/mod_autoindex.so
+LoadModule asis_module libexec/apache2/mod_asis.so
+#LoadModule info_module libexec/apache2/mod_info.so
+LoadModule cgi_module libexec/apache2/mod_cgi.so
+#LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
+#LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
+LoadModule negotiation_module libexec/apache2/mod_negotiation.so
+#LoadModule dir_module libexec/apache2/mod_dir.so
+LoadModule imagemap_module libexec/apache2/mod_imagemap.so
+LoadModule actions_module libexec/apache2/mod_actions.so
+#LoadModule speling_module libexec/apache2/mod_speling.so
+#LoadModule userdir_module libexec/apache2/mod_userdir.so
+LoadModule alias_module libexec/apache2/mod_alias.so
+LoadModule rewrite_module libexec/apache2/mod_rewrite.so
+#LoadModule bonjour_module libexec/apache2/mod_bonjour.so
+LoadModule php5_module libexec/apache2/libphp5.so
+#LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
+
+### Section 2: 'Main' server configuration
+#
+# The directives in this section set up the values used by the 'main'
+# server, which responds to any requests that aren't handled by a
+# <VirtualHost> definition. These values also provide defaults for
+# any <VirtualHost> containers you may define later in the file.
+#
+# All of these directives may appear inside <VirtualHost> containers,
+# in which case these default settings will be overridden for the
+# virtual host being defined.
+#
+
+#
+# ServerName allows you to set a host name which is sent back to clients for
+# your server if it's different than the one the program would get (i.e., use
+# "www" instead of the host's real name).
+#
+# Note: You cannot just invent host names and hope they work. The name you
+# define here must be a valid DNS name for your host. If you don't understand
+# this, ask your network administrator.
+# If your host doesn't have a registered DNS name, enter its IP address here.
+# You will have to access it by its address (e.g., http://123.45.67.89/)
+# anyway, and this will make redirections work in a sensible way.
+#
+# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
+# machine always knows itself by this address. If you use Apache strictly for
+# local testing and development, you may use 127.0.0.1 as the server name.
+#
+ServerName 127.0.0.1
+
+#
+# DocumentRoot: The directory out of which you will serve your
+# documents. By default, all requests are taken from this directory, but
+# symbolic links and aliases may be used to point to other locations.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#DocumentRoot "/Library/WebServer/Documents"
+
+#
+# Each directory to which Apache has access, can be configured with respect
+# to which services and features are allowed and/or disabled in that
+# directory (and its subdirectories).
+#
+<Directory />
+#
+# This may also be "None", "All", or any combination of "Indexes",
+# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
+#
+# Note that "MultiViews" must be named *explicitly* --- "Options All"
+# doesn't give it to you.
+#
+ Options Indexes FollowSymLinks MultiViews ExecCGI Includes
+
+#
+# This controls which options the .htaccess files in directories can
+# override. Can also be "All", or any combination of "Options", "FileInfo",
+# "AuthConfig", and "Limit"
+#
+ AllowOverride All
+
+#
+# Controls who can get stuff from this server.
+#
+ Order allow,deny
+ Allow from all
+</Directory>
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for access control information.
+#
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess files from being viewed by
+# Web clients. Since .htaccess files often contain authorization
+# information, access is disallowed for security reasons. Comment
+# these lines out if you want Web visitors to see the contents of
+# .htaccess files. If you change the AccessFileName directive above,
+# be sure to make the corresponding changes here.
+#
+# Also, folks tend to use names such as .htpasswd for password
+# files, so this will protect those as well.
+#
+<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+#
+# Apple specific filesystem protection.
+#
+
+<Files "rsrc">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+<Directory ~ ".*\.\.namedfork">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Directory>
+
+#
+# CacheNegotiatedDocs: By default, Apache sends "Pragma: no-cache" with each
+# document that was negotiated on the basis of content. This asks proxy
+# servers not to cache the document. Uncommenting the following line disables
+# this behavior, and proxies will be allowed to cache the documents.
+#
+#CacheNegotiatedDocs
+
+#
+# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
+# Apache needs to construct a self-referencing URL (a URL that refers back
+# to the server the response is coming from) it will use ServerName and
+# Port to form a "canonical" name. With this setting off, Apache will
+# use the hostname:port that the client supplied, when possible. This
+# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
+#
+UseCanonicalName On
+
+#
+# TypesConfig describes where the mime.types file (or equivalent) is
+# to be found.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#
+#<IfModule mod_mime.c>
+# TypesConfig /private/etc/apache2/mime.types
+#</IfModule>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+#
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#ErrorLog "/tmp/layout-test-results/error_log"
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+#
+# The location and format of the access logfile (Common Logfile Format).
+# If you do not define any access logfiles within a <VirtualHost>
+# container, they will be logged here. Contrariwise, if you *do*
+# define per-<VirtualHost> access logfiles, transactions will be
+# logged therein and *not* in this file.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#CustomLog "/tmp/layout-test-results/access_log" common
+
+#
+# If you prefer a single logfile with access, agent, and referer information
+# (Combined Logfile Format) you can use the following directive.
+#
+#CustomLog "/tmp/layout-test-results/access_log" combined
+
+#
+# Optionally add a line containing the server version and virtual host
+# name to server-generated pages (error documents, FTP directory listings,
+# mod_status and mod_info output etc., but not CGI generated documents).
+# Set to "EMail" to also include a mailto: link to the ServerAdmin.
+# Set to one of: On | Off | EMail
+#
+ServerSignature On
+
+#
+# Aliases: Add here as many aliases as you need (with no limit). The format is
+# Alias fakename realname
+#
+<IfModule mod_alias.c>
+</IfModule>
+# End of aliases.
+
+#
+# Redirect allows you to tell clients about documents which used to exist in
+# your server's namespace, but do not anymore. This allows you to tell the
+# clients where to look for the relocated document.
+# Format: Redirect old-URI new-URL
+#
+
+#
+# Document types.
+#
+<IfModule mod_mime.c>
+
+ #
+ # AddLanguage allows you to specify the language of a document. You can
+ # then use content negotiation to give a browser a file in a language
+ # it can understand.
+ #
+ # Note 1: The suffix does not have to be the same as the language
+ # keyword --- those with documents in Polish (whose net-standard
+ # language code is pl) may wish to use "AddLanguage pl .po" to
+ # avoid the ambiguity with the common suffix for perl scripts.
+ #
+ # Note 2: The example entries below illustrate that in quite
+ # some cases the two character 'Language' abbreviation is not
+ # identical to the two character 'Country' code for its country,
+ # E.g. 'Danmark/dk' versus 'Danish/da'.
+ #
+ # Note 3: In the case of 'ltz' we violate the RFC by using a three char
+ # specifier. But there is 'work in progress' to fix this and get
+ # the reference data for rfc1766 cleaned up.
+ #
+ # Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
+ # French (fr) - German (de) - Greek-Modern (el)
+ # Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)
+ # Portugese (pt) - Luxembourgeois* (ltz)
+ # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
+ # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
+ # Russian (ru)
+ #
+ AddLanguage da .dk
+ AddLanguage nl .nl
+ AddLanguage en .en
+ AddLanguage et .ee
+ AddLanguage fr .fr
+ AddLanguage de .de
+ AddLanguage el .el
+ AddLanguage he .he
+ AddCharset ISO-8859-8 .iso8859-8
+ AddLanguage it .it
+ AddLanguage ja .ja
+ AddCharset ISO-2022-JP .jis
+ AddLanguage kr .kr
+ AddCharset ISO-2022-KR .iso-kr
+ AddLanguage nn .nn
+ AddLanguage no .no
+ AddLanguage pl .po
+ AddCharset ISO-8859-2 .iso-pl
+ AddLanguage pt .pt
+ AddLanguage pt-br .pt-br
+ AddLanguage ltz .lu
+ AddLanguage ca .ca
+ AddLanguage es .es
+ AddLanguage sv .sv
+ AddLanguage cs .cz .cs
+ AddLanguage ru .ru
+ AddLanguage zh-TW .zh-tw
+ AddCharset Big5 .Big5 .big5
+ AddCharset WINDOWS-1251 .cp-1251
+ AddCharset CP866 .cp866
+ AddCharset ISO-8859-5 .iso-ru
+ AddCharset KOI8-R .koi8-r
+ AddCharset UCS-2 .ucs2
+ AddCharset UCS-4 .ucs4
+ AddCharset UTF-8 .utf8
+
+ # LanguagePriority allows you to give precedence to some languages
+ # in case of a tie during content negotiation.
+ #
+ # Just list the languages in decreasing order of preference. We have
+ # more or less alphabetized them here. You probably want to change this.
+ #
+ <IfModule mod_negotiation.c>
+ LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
+ </IfModule>
+
+ #
+ # AddType allows you to tweak mime.types without actually editing it, or to
+ # make certain files to be certain types.
+ #
+ AddType application/x-tar .tgz
+
+ #
+ # AddEncoding allows you to have certain browsers uncompress
+ # information on the fly. Note: Not all browsers support this.
+ # Despite the name similarity, the following Add* directives have nothing
+ # to do with the FancyIndexing customization directives above.
+ #
+ AddEncoding x-compress .Z
+ AddEncoding x-gzip .gz .tgz
+ #
+ # If the AddEncoding directives above are commented-out, then you
+ # probably should define those extensions to indicate media types:
+ #
+ #AddType application/x-compress .Z
+ #AddType application/x-gzip .gz .tgz
+
+ #
+ # AddHandler allows you to map certain file extensions to "handlers",
+ # actions unrelated to filetype. These can be either built into the server
+ # or added with the Action command (see below)
+ #
+ # If you want to use server side includes, or CGI outside
+ # ScriptAliased directories, uncomment the following lines.
+ #
+ # To use CGI scripts:
+ #
+ AddHandler cgi-script .cgi .pl
+
+ #
+ # To use server-parsed HTML files
+ #
+ AddType text/html .shtml
+ AddHandler server-parsed .shtml
+
+ #
+ # Uncomment the following line to enable Apache's send-asis HTTP file
+ # feature
+ #
+ AddHandler send-as-is asis
+
+ #
+ # If you wish to use server-parsed imagemap files, use
+ #
+ #AddHandler imap-file map
+
+ #
+ # To enable type maps, you might want to use
+ #
+ #AddHandler type-map var
+
+</IfModule>
+# End of document types.
+
+#
+# Action lets you define media types that will execute a script whenever
+# a matching file is called. This eliminates the need for repeated URL
+# pathnames for oft-used CGI file processors.
+# Format: Action media/type /cgi-script/location
+# Format: Action handler-name /cgi-script/location
+#
+
+#
+# MetaDir: specifies the name of the directory in which Apache can find
+# meta information files. These files contain additional HTTP headers
+# to include when sending the document
+#
+#MetaDir .web
+
+#
+# MetaSuffix: specifies the file name suffix for the file containing the
+# meta information.
+#
+#MetaSuffix .meta
+
+#
+# Customizable error response (Apache style)
+# these come in three flavors
+#
+# 1) plain text
+#ErrorDocument 500 "The server made a boo boo.
+# n.b. the single leading (") marks it as text, it does not get output
+#
+# 2) local redirects
+#ErrorDocument 404 /missing.html
+# to redirect to local URL /missing.html
+#ErrorDocument 404 /cgi-bin/missing_handler.pl
+# N.B.: You can redirect to a script or a document using server-side-includes.
+#
+# 3) external redirects
+#ErrorDocument 402 http://some.other-server.com/subscription_info.html
+# N.B.: Many of the environment variables associated with the original
+# request will *not* be available to such a script.
+
+#
+# Proxy Server directives. Uncomment the following lines to
+# enable the proxy server:
+#
+#<IfModule mod_proxy.c>
+# ProxyRequests On
+
+# <Directory proxy:*>
+# Order deny,allow
+# Deny from all
+# Allow from .your-domain.com
+# </Directory>
+
+ #
+ # Enable/disable the handling of HTTP/1.1 "Via:" headers.
+ # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
+ # Set to one of: Off | On | Full | Block
+ #
+# ProxyVia On
+
+ #
+ # To enable the cache as well, edit and uncomment the following lines:
+ # (no cacheing without CacheRoot)
+ #
+# CacheRoot "/private/var/run/proxy"
+# CacheSize 5
+# CacheGcInterval 4
+# CacheMaxExpire 24
+# CacheLastModifiedFactor 0.1
+# CacheDefaultExpire 1
+# NoCache a-domain.com another-domain.edu joes.garage-sale.com
+
+#</IfModule>
+# End of proxy directives.
+
+
+<IfModule mod_php5.c>
+ # If php is turned on, we repsect .php and .phps files.
+ AddType application/x-httpd-php .php
+ AddType application/x-httpd-php .bat
+ AddType application/x-httpd-php-source .phps
+
+ # Since most users will want index.php to work we
+ # also automatically enable index.php
+ <IfModule mod_dir.c>
+ DirectoryIndex index.html index.php
+ </IfModule>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_METHOD} ^TRACE
+ RewriteRule .* - [F]
+</IfModule>
+
+<VirtualHost 127.0.0.1:8443>
+ ServerName 127.0.0.1
+ SSLEngine On
+</VirtualHost>
diff --git a/LayoutTests/http/conf/cygwin-httpd.conf b/LayoutTests/http/conf/cygwin-httpd.conf
new file mode 100644
index 0000000..a79ed39
--- /dev/null
+++ b/LayoutTests/http/conf/cygwin-httpd.conf
@@ -0,0 +1,731 @@
+##
+## httpd.conf -- Apache HTTP server configuration file
+##
+
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file. It contains the
+# configuration directives that give the server its instructions.
+# See <URL:http://httpd.apache.org/docs/> for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do. They're here only as hints or reminders. If you are unsure
+# consult the online docs. You have been warned.
+#
+# After this file is processed, the server will look for and process
+# /private/etc/httpd/srm.conf and then /private/etc/httpd/access.conf
+# unless you have overridden these with ResourceConfig and/or
+# AccessConfig directives here.
+#
+# The configuration directives are grouped into three basic sections:
+# 1. Directives that control the operation of the Apache server process as a
+# whole (the 'global environment').
+# 2. Directives that define the parameters of the 'main' or 'default' server,
+# which responds to requests that aren't handled by a virtual host.
+# These directives also provide default values for the settings
+# of all virtual hosts.
+# 3. Settings for virtual hosts, which allow Web requests to be sent to
+# different IP addresses or hostnames and have them handled by the
+# same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path. If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
+# with ServerRoot set to "/usr/local/apache" will be interpreted by the
+# server as "/usr/local/apache/logs/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerType is either inetd, or standalone. Inetd mode is only supported on
+# Unix platforms.
+#
+ServerType standalone
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE! If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation
+# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+ServerRoot "/usr"
+
+#
+# The LockFile directive sets the path to the lockfile used when Apache
+# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
+# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
+# its default value. The main reason for changing it is if the logs
+# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
+# DISK. The PID of the main server process is automatically appended to
+# the filename.
+#
+LockFile "/tmp/WebKit/httpd.lock"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+PidFile "/tmp/WebKit/httpd.pid"
+
+#
+# ScoreBoardFile: File used to store internal server process information.
+# Not all architectures require this. But if yours does (you'll know because
+# this file will be created when you run Apache) then you *must* ensure that
+# no two invocations of Apache share the same scoreboard file.
+#
+ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
+
+#
+# In the standard configuration, the server will process httpd.conf (this
+# file, specified by the -f command line option), srm.conf, and access.conf
+# in that order. The latter two files are now distributed empty, as it is
+# recommended that all directives be kept in a single file for simplicity.
+# The commented-out values below are the built-in defaults. You can have the
+# server ignore these files altogether by using "/dev/null" (for Unix) or
+# "nul" (for Win32) for the arguments to the directives.
+#
+ResourceConfig /dev/null
+AccessConfig /dev/null
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 15
+
+#
+# Server-pool size regulation. Rather than making you guess how many
+# server processes you need, Apache dynamically adapts to the load it
+# sees --- that is, it tries to maintain enough server processes to
+# handle the current load, plus a few spare servers to handle transient
+# load spikes (e.g., multiple simultaneous requests from a single
+# Netscape browser).
+#
+# It does this by periodically checking how many servers are waiting
+# for a request. If there are fewer than MinSpareServers, it creates
+# a new spare. If there are more than MaxSpareServers, some of the
+# spares die off. The default values are probably OK for most sites.
+#
+MinSpareServers 1
+MaxSpareServers 5
+
+#
+# Number of servers to start initially --- should be a reasonable ballpark
+# figure.
+#
+StartServers 1
+
+#
+# Limit on total number of servers running, i.e., limit on the number
+# of clients who can simultaneously connect --- if this limit is ever
+# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
+# It is intended mainly as a brake to keep a runaway server from taking
+# the system with it as it spirals down...
+#
+MaxClients 150
+
+#
+# MaxRequestsPerChild: the number of requests each child process is
+# allowed to process before the child dies. The child will exit so
+# as to avoid problems after prolonged use when Apache (and maybe the
+# libraries it uses) leak memory or other resources. On most systems, this
+# isn't really needed, but a few (such as Solaris) do have notable leaks
+# in the libraries. For these platforms, set to something like 10000
+# or so; a setting of 0 means unlimited.
+#
+# NOTE: This value does not include keepalive requests after the initial
+# request per connection. For example, if a child process handles
+# an initial request and 10 subsequent "keptalive" requests, it
+# would only count as 1 request towards this limit.
+#
+MaxRequestsPerChild 100000
+
+#
+# Listen: Allows you to bind Apache to specific IP addresses and/or
+# ports, instead of the default. See also the <VirtualHost>
+# directive.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#
+#Listen 3000
+Listen 127.0.0.1:8080
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+# To be able to use the functionality of a module which was built as a DSO you
+# have to place corresponding `LoadModule' lines at this location so the
+# directives contained in it are actually available _before_ they are used.
+# Please read the file http://httpd.apache.org/docs/dso.html for more
+# details about the DSO mechanism and run `httpd -l' for the list of already
+# built-in (statically linked and thus always available) modules in your httpd
+# binary.
+#
+# Note: The order in which modules are loaded is important. Don't change
+# the order below without expert advice.
+#
+# Example:
+# LoadModule foo_module libexec/mod_foo.so
+#LoadModule vhost_alias_module lib/apache/mod_vhost_alias.dll
+#LoadModule env_module lib/apache/mod_env.dll
+LoadModule config_log_module lib/apache/mod_log_config.dll
+#LoadModule agent_log_module lib/apache/mod_log_agent.dll
+#LoadModule referer_log_module lib/apache/mod_log_referer.dll
+#LoadModule mime_magic_module lib/apache/mod_mime_magic.dll
+LoadModule mime_module lib/apache/mod_mime.dll
+LoadModule negotiation_module lib/apache/mod_negotiation.dll
+#LoadModule status_module lib/apache/mod_status.dll
+#LoadModule info_module lib/apache/mod_info.dll
+LoadModule includes_module lib/apache/mod_include.dll
+#LoadModule autoindex_module lib/apache/mod_autoindex.dll
+#LoadModule dir_module lib/apache/mod_dir.dll
+LoadModule cgi_module lib/apache/mod_cgi.dll
+LoadModule asis_module lib/apache/mod_asis.dll
+LoadModule imap_module lib/apache/mod_imap.dll
+LoadModule action_module lib/apache/mod_actions.dll
+#LoadModule speling_module lib/apache/mod_speling.dll
+#LoadModule userdir_module lib/apache/mod_userdir.dll
+LoadModule alias_module lib/apache/mod_alias.dll
+LoadModule rewrite_module lib/apache/mod_rewrite.dll
+LoadModule access_module lib/apache/mod_access.dll
+LoadModule auth_module lib/apache/mod_auth.dll
+#LoadModule anon_auth_module lib/apache/mod_auth_anon.dll
+#LoadModule digest_module lib/apache/mod_digest.dll
+#LoadModule proxy_module lib/apache/libproxy.dll
+#LoadModule cern_meta_module lib/apache/mod_cern_meta.dll
+#LoadModule expires_module lib/apache/mod_expires.dll
+LoadModule headers_module lib/apache/mod_headers.dll
+#LoadModule usertrack_module lib/apache/mod_usertrack.dll
+#LoadModule example_module lib/apache/mod_example.dll
+#LoadModule log_forensic_module lib/apache/mod_log_forensic.dll
+#LoadModule unique_id_module lib/apache/mod_unique_id.dll
+#LoadModule setenvif_module lib/apache/mod_setenvif.dll
+LoadModule php4_module lib/apache/libphp4.dll
+#LoadModule hfs_apple_module lib/apache/mod_hfs_apple.so
+#LoadModule bonjour_module lib/apache/mod_bonjour.so
+
+# Reconstruction of the complete module list from all available modules
+# (static and shared ones) to achieve correct module execution order.
+# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
+ClearModuleList
+#AddModule mod_vhost_alias.c
+#AddModule mod_env.c
+AddModule mod_log_config.c
+#AddModule mod_mime_magic.c
+AddModule mod_mime.c
+AddModule mod_negotiation.c
+#AddModule mod_status.c
+#AddModule mod_info.c
+AddModule mod_include.c
+#AddModule mod_autoindex.c
+#AddModule mod_dir.c
+AddModule mod_cgi.c
+AddModule mod_asis.c
+AddModule mod_imap.c
+AddModule mod_actions.c
+#AddModule mod_speling.c
+#AddModule mod_userdir.c
+AddModule mod_alias.c
+AddModule mod_rewrite.c
+AddModule mod_access.c
+AddModule mod_auth.c
+#AddModule mod_auth_anon.c
+#AddModule mod_auth_dbm.c
+#AddModule mod_digest.c
+#AddModule mod_proxy.c
+#AddModule mod_cern_meta.c
+#AddModule mod_expires.c
+AddModule mod_headers.c
+#AddModule mod_usertrack.c
+#AddModule mod_log_forensic.c
+#AddModule mod_unique_id.c
+AddModule mod_so.c
+#AddModule mod_setenvif.c
+#AddModule mod_dav.c
+#AddModule mod_ssl.c
+#AddModule mod_perl.c
+AddModule mod_php4.c
+#AddModule mod_hfs_apple.c
+#AddModule mod_bonjour.c
+
+### Section 2: 'Main' server configuration
+#
+# The directives in this section set up the values used by the 'main'
+# server, which responds to any requests that aren't handled by a
+# <VirtualHost> definition. These values also provide defaults for
+# any <VirtualHost> containers you may define later in the file.
+#
+# All of these directives may appear inside <VirtualHost> containers,
+# in which case these default settings will be overridden for the
+# virtual host being defined.
+#
+
+#
+# ServerName allows you to set a host name which is sent back to clients for
+# your server if it's different than the one the program would get (i.e., use
+# "www" instead of the host's real name).
+#
+# Note: You cannot just invent host names and hope they work. The name you
+# define here must be a valid DNS name for your host. If you don't understand
+# this, ask your network administrator.
+# If your host doesn't have a registered DNS name, enter its IP address here.
+# You will have to access it by its address (e.g., http://123.45.67.89/)
+# anyway, and this will make redirections work in a sensible way.
+#
+# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
+# machine always knows itself by this address. If you use Apache strictly for
+# local testing and development, you may use 127.0.0.1 as the server name.
+#
+ServerName 127.0.0.1
+
+#
+# DocumentRoot: The directory out of which you will serve your
+# documents. By default, all requests are taken from this directory, but
+# symbolic links and aliases may be used to point to other locations.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#DocumentRoot "/var/www/htdocs"
+
+#
+# Each directory to which Apache has access, can be configured with respect
+# to which services and features are allowed and/or disabled in that
+# directory (and its subdirectories).
+#
+<Directory />
+#
+# This may also be "None", "All", or any combination of "Indexes",
+# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
+#
+# Note that "MultiViews" must be named *explicitly* --- "Options All"
+# doesn't give it to you.
+#
+ Options Indexes FollowSymLinks MultiViews ExecCGI Includes
+
+#
+# This controls which options the .htaccess files in directories can
+# override. Can also be "All", or any combination of "Options", "FileInfo",
+# "AuthConfig", and "Limit"
+#
+ AllowOverride All
+
+#
+# Controls who can get stuff from this server.
+#
+ Order allow,deny
+ Allow from all
+</Directory>
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for access control information.
+#
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess files from being viewed by
+# Web clients. Since .htaccess files often contain authorization
+# information, access is disallowed for security reasons. Comment
+# these lines out if you want Web visitors to see the contents of
+# .htaccess files. If you change the AccessFileName directive above,
+# be sure to make the corresponding changes here.
+#
+# Also, folks tend to use names such as .htpasswd for password
+# files, so this will protect those as well.
+#
+<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+#
+# Apple specific filesystem protection.
+#
+
+<Files "rsrc">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+<Directory ~ ".*\.\.namedfork">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Directory>
+
+#
+# CacheNegotiatedDocs: By default, Apache sends "Pragma: no-cache" with each
+# document that was negotiated on the basis of content. This asks proxy
+# servers not to cache the document. Uncommenting the following line disables
+# this behavior, and proxies will be allowed to cache the documents.
+#
+#CacheNegotiatedDocs
+
+#
+# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
+# Apache needs to construct a self-referencing URL (a URL that refers back
+# to the server the response is coming from) it will use ServerName and
+# Port to form a "canonical" name. With this setting off, Apache will
+# use the hostname:port that the client supplied, when possible. This
+# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
+#
+UseCanonicalName On
+
+#
+# TypesConfig describes where the mime.types file (or equivalent) is
+# to be found.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#
+#<IfModule mod_mime.c>
+# TypesConfig /etc/apache/mime.types
+#</IfModule>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+#
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#ErrorLog "/tmp/layout-test-results/error_log"
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+#
+# The location and format of the access logfile (Common Logfile Format).
+# If you do not define any access logfiles within a <VirtualHost>
+# container, they will be logged here. Contrariwise, if you *do*
+# define per-<VirtualHost> access logfiles, transactions will be
+# logged therein and *not* in this file.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#CustomLog "/tmp/layout-test-results/access_log" common
+
+#
+# If you prefer a single logfile with access, agent, and referer information
+# (Combined Logfile Format) you can use the following directive.
+#
+#CustomLog "/tmp/layout-test-results/access_log" combined
+
+#
+# Optionally add a line containing the server version and virtual host
+# name to server-generated pages (error documents, FTP directory listings,
+# mod_status and mod_info output etc., but not CGI generated documents).
+# Set to "EMail" to also include a mailto: link to the ServerAdmin.
+# Set to one of: On | Off | EMail
+#
+ServerSignature On
+
+#
+# Aliases: Add here as many aliases as you need (with no limit). The format is
+# Alias fakename realname
+#
+<IfModule mod_alias.c>
+</IfModule>
+# End of aliases.
+
+#
+# Redirect allows you to tell clients about documents which used to exist in
+# your server's namespace, but do not anymore. This allows you to tell the
+# clients where to look for the relocated document.
+# Format: Redirect old-URI new-URL
+#
+
+#
+# Document types.
+#
+<IfModule mod_mime.c>
+
+ #
+ # AddLanguage allows you to specify the language of a document. You can
+ # then use content negotiation to give a browser a file in a language
+ # it can understand.
+ #
+ # Note 1: The suffix does not have to be the same as the language
+ # keyword --- those with documents in Polish (whose net-standard
+ # language code is pl) may wish to use "AddLanguage pl .po" to
+ # avoid the ambiguity with the common suffix for perl scripts.
+ #
+ # Note 2: The example entries below illustrate that in quite
+ # some cases the two character 'Language' abbreviation is not
+ # identical to the two character 'Country' code for its country,
+ # E.g. 'Danmark/dk' versus 'Danish/da'.
+ #
+ # Note 3: In the case of 'ltz' we violate the RFC by using a three char
+ # specifier. But there is 'work in progress' to fix this and get
+ # the reference data for rfc1766 cleaned up.
+ #
+ # Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
+ # French (fr) - German (de) - Greek-Modern (el)
+ # Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)
+ # Portugese (pt) - Luxembourgeois* (ltz)
+ # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
+ # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
+ # Russian (ru)
+ #
+ AddLanguage da .dk
+ AddLanguage nl .nl
+ AddLanguage en .en
+ AddLanguage et .ee
+ AddLanguage fr .fr
+ AddLanguage de .de
+ AddLanguage el .el
+ AddLanguage he .he
+ AddCharset ISO-8859-8 .iso8859-8
+ AddLanguage it .it
+ AddLanguage ja .ja
+ AddCharset ISO-2022-JP .jis
+ AddLanguage kr .kr
+ AddCharset ISO-2022-KR .iso-kr
+ AddLanguage nn .nn
+ AddLanguage no .no
+ AddLanguage pl .po
+ AddCharset ISO-8859-2 .iso-pl
+ AddLanguage pt .pt
+ AddLanguage pt-br .pt-br
+ AddLanguage ltz .lu
+ AddLanguage ca .ca
+ AddLanguage es .es
+ AddLanguage sv .sv
+ AddLanguage cs .cz .cs
+ AddLanguage ru .ru
+ AddLanguage zh-TW .zh-tw
+ AddCharset Big5 .Big5 .big5
+ AddCharset WINDOWS-1251 .cp-1251
+ AddCharset CP866 .cp866
+ AddCharset ISO-8859-5 .iso-ru
+ AddCharset KOI8-R .koi8-r
+ AddCharset UCS-2 .ucs2
+ AddCharset UCS-4 .ucs4
+ AddCharset UTF-8 .utf8
+
+ # LanguagePriority allows you to give precedence to some languages
+ # in case of a tie during content negotiation.
+ #
+ # Just list the languages in decreasing order of preference. We have
+ # more or less alphabetized them here. You probably want to change this.
+ #
+ <IfModule mod_negotiation.c>
+ LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
+ </IfModule>
+
+ #
+ # AddType allows you to tweak mime.types without actually editing it, or to
+ # make certain files to be certain types.
+ #
+ AddType application/x-tar .tgz
+
+ #
+ # AddEncoding allows you to have certain browsers uncompress
+ # information on the fly. Note: Not all browsers support this.
+ # Despite the name similarity, the following Add* directives have nothing
+ # to do with the FancyIndexing customization directives above.
+ #
+ AddEncoding x-compress .Z
+ AddEncoding x-gzip .gz .tgz
+ #
+ # If the AddEncoding directives above are commented-out, then you
+ # probably should define those extensions to indicate media types:
+ #
+ #AddType application/x-compress .Z
+ #AddType application/x-gzip .gz .tgz
+
+ #
+ # AddHandler allows you to map certain file extensions to "handlers",
+ # actions unrelated to filetype. These can be either built into the server
+ # or added with the Action command (see below)
+ #
+ # If you want to use server side includes, or CGI outside
+ # ScriptAliased directories, uncomment the following lines.
+ #
+ # To use CGI scripts:
+ #
+ AddHandler cgi-script .cgi .pl
+
+ #
+ # To use server-parsed HTML files
+ #
+ AddType text/html .shtml
+ AddHandler server-parsed .shtml
+
+ #
+ # Uncomment the following line to enable Apache's send-asis HTTP file
+ # feature
+ #
+ AddHandler send-as-is asis
+
+ #
+ # If you wish to use server-parsed imagemap files, use
+ #
+ #AddHandler imap-file map
+
+ #
+ # To enable type maps, you might want to use
+ #
+ #AddHandler type-map var
+
+</IfModule>
+# End of document types.
+
+#
+# Action lets you define media types that will execute a script whenever
+# a matching file is called. This eliminates the need for repeated URL
+# pathnames for oft-used CGI file processors.
+# Format: Action media/type /cgi-script/location
+# Format: Action handler-name /cgi-script/location
+#
+
+#
+# MetaDir: specifies the name of the directory in which Apache can find
+# meta information files. These files contain additional HTTP headers
+# to include when sending the document
+#
+#MetaDir .web
+
+#
+# MetaSuffix: specifies the file name suffix for the file containing the
+# meta information.
+#
+#MetaSuffix .meta
+
+#
+# Customizable error response (Apache style)
+# these come in three flavors
+#
+# 1) plain text
+#ErrorDocument 500 "The server made a boo boo.
+# n.b. the single leading (") marks it as text, it does not get output
+#
+# 2) local redirects
+#ErrorDocument 404 /missing.html
+# to redirect to local URL /missing.html
+#ErrorDocument 404 /cgi-bin/missing_handler.pl
+# N.B.: You can redirect to a script or a document using server-side-includes.
+#
+# 3) external redirects
+#ErrorDocument 402 http://some.other-server.com/subscription_info.html
+# N.B.: Many of the environment variables associated with the original
+# request will *not* be available to such a script.
+
+#
+# Proxy Server directives. Uncomment the following lines to
+# enable the proxy server:
+#
+#<IfModule mod_proxy.c>
+# ProxyRequests On
+
+# <Directory proxy:*>
+# Order deny,allow
+# Deny from all
+# Allow from .your-domain.com
+# </Directory>
+
+ #
+ # Enable/disable the handling of HTTP/1.1 "Via:" headers.
+ # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
+ # Set to one of: Off | On | Full | Block
+ #
+# ProxyVia On
+
+ #
+ # To enable the cache as well, edit and uncomment the following lines:
+ # (no cacheing without CacheRoot)
+ #
+# CacheRoot "/private/var/run/proxy"
+# CacheSize 5
+# CacheGcInterval 4
+# CacheMaxExpire 24
+# CacheLastModifiedFactor 0.1
+# CacheDefaultExpire 1
+# NoCache a-domain.com another-domain.edu joes.garage-sale.com
+
+#</IfModule>
+# End of proxy directives.
+
+
+<IfModule mod_php4.c>
+ # If php is turned on, we repsect .php and .phps files.
+ AddType application/x-httpd-php .php
+ AddType application/x-httpd-php .bat
+ AddType application/x-httpd-php-source .phps
+
+ # Since most users will want index.php to work we
+ # also automatically enable index.php
+ <IfModule mod_dir.c>
+ DirectoryIndex index.html index.php
+ </IfModule>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_METHOD} ^TRACE
+ RewriteRule .* - [F]
+</IfModule>
diff --git a/LayoutTests/http/conf/fedora-httpd.conf b/LayoutTests/http/conf/fedora-httpd.conf
new file mode 100644
index 0000000..cd71d88
--- /dev/null
+++ b/LayoutTests/http/conf/fedora-httpd.conf
@@ -0,0 +1,882 @@
+#
+# This is the main Apache server configuration file. It contains the
+# configuration directives that give the server its instructions.
+# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
+# In particular, see
+# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
+# for a discussion of each configuration directive.
+#
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do. They're here only as hints or reminders. If you are unsure
+# consult the online docs. You have been warned.
+#
+# The configuration directives are grouped into three basic sections:
+# 1. Directives that control the operation of the Apache server process as a
+# whole (the 'global environment').
+# 2. Directives that define the parameters of the 'main' or 'default' server,
+# which responds to requests that aren't handled by a virtual host.
+# These directives also provide default values for the settings
+# of all virtual hosts.
+# 3. Settings for virtual hosts, which allow Web requests to be sent to
+# different IP addresses or hostnames and have them handled by the
+# same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path. If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
+# with ServerRoot set to "/etc/httpd" will be interpreted by the
+# server as "/etc/httpd/logs/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# Don't give away too much information about all the subcomponents
+# we are running. Comment out this line if you don't mind remote sites
+# finding out what major optional modules you are running
+ServerTokens OS
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE! If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation
+# (available at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+# Do NOT add a slash at the end of the directory path.
+#
+ServerRoot "/etc/httpd"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+LockFile "/tmp/WebKit/httpd.lock"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+PidFile "/tmp/WebKit/httpd.pid"
+
+#
+# ScoreBoardFile: File used to store internal server process information.
+# Not all architectures require this. But if yours does (you'll know because
+# this file will be created when you run Apache) then you *must* ensure that
+# no two invocations of Apache share the same scoreboard file.
+#
+ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 15
+
+MinSpareServers 1
+MaxSpareServers 5
+StartServers 1
+MaxClients 150
+
+##
+## Server-Pool Size Regulation (MPM specific)
+##
+
+# prefork MPM
+# StartServers: number of server processes to start
+# MinSpareServers: minimum number of server processes which are kept spare
+# MaxSpareServers: maximum number of server processes which are kept spare
+# ServerLimit: maximum value for MaxClients for the lifetime of the server
+# MaxClients: maximum number of server processes allowed to start
+# MaxRequestsPerChild: maximum number of requests a server process serves
+
+# worker MPM
+# StartServers: initial number of server processes to start
+# MaxClients: maximum number of simultaneous client connections
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxRequestsPerChild: maximum number of requests a server process serves
+
+MaxRequestsPerChild 100000
+
+#
+# Listen: Allows you to bind Apache to specific IP addresses and/or
+# ports, in addition to the default. See also the <VirtualHost>
+# directive.
+#
+# Change this to Listen on specific IP addresses as shown below to
+# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
+#
+#Listen 12.34.56.78:80
+Listen 127.0.0.1:8080
+Listen 127.0.0.1:8443
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+# To be able to use the functionality of a module which was built as a DSO you
+# have to place corresponding `LoadModule' lines at this location so the
+# directives contained in it are actually available _before_ they are used.
+# Statically compiled modules (those listed by `httpd -l') do not need
+# to be loaded here.
+#
+# Example:
+# LoadModule foo_module modules/mod_foo.so
+#
+#LoadModule auth_basic_module modules/mod_auth_basic.so
+#LoadModule auth_digest_module modules/mod_auth_digest.so
+#LoadModule authn_file_module modules/mod_authn_file.so
+#LoadModule authn_alias_module modules/mod_authn_alias.so
+#LoadModule authn_anon_module modules/mod_authn_anon.so
+#LoadModule authn_dbm_module modules/mod_authn_dbm.so
+#LoadModule authn_default_module modules/mod_authn_default.so
+LoadModule authz_host_module modules/mod_authz_host.so
+#LoadModule authz_user_module modules/mod_authz_user.so
+#LoadModule authz_owner_module modules/mod_authz_owner.so
+#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
+#LoadModule authz_dbm_module modules/mod_authz_dbm.so
+#LoadModule authz_default_module modules/mod_authz_default.so
+#LoadModule ldap_module modules/mod_ldap.so
+#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
+LoadModule include_module modules/mod_include.so
+LoadModule log_config_module modules/mod_log_config.so
+#LoadModule logio_module modules/mod_logio.so
+#LoadModule env_module modules/mod_env.so
+#LoadModule ext_filter_module modules/mod_ext_filter.so
+#LoadModule mime_magic_module modules/mod_mime_magic.so
+#LoadModule expires_module modules/mod_expires.so
+#LoadModule deflate_module modules/mod_deflate.so
+LoadModule headers_module modules/mod_headers.so
+#LoadModule usertrack_module modules/mod_usertrack.so
+#LoadModule setenvif_module modules/mod_setenvif.so
+LoadModule mime_module modules/mod_mime.so
+#LoadModule dav_module modules/mod_dav.so
+#LoadModule status_module modules/mod_status.so
+#LoadModule autoindex_module modules/mod_autoindex.so
+#LoadModule info_module modules/mod_info.so
+#LoadModule dav_fs_module modules/mod_dav_fs.so
+#LoadModule vhost_alias_module modules/mod_vhost_alias.so
+LoadModule negotiation_module modules/mod_negotiation.so
+#LoadModule dir_module modules/mod_dir.so
+LoadModule actions_module modules/mod_actions.so
+#LoadModule speling_module modules/mod_speling.so
+#LoadModule userdir_module modules/mod_userdir.so
+LoadModule alias_module modules/mod_alias.so
+LoadModule rewrite_module modules/mod_rewrite.so
+#LoadModule proxy_module modules/mod_proxy.so
+#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
+#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
+#LoadModule proxy_http_module modules/mod_proxy_http.so
+#LoadModule proxy_connect_module modules/mod_proxy_connect.so
+#LoadModule cache_module modules/mod_cache.so
+#LoadModule suexec_module modules/mod_suexec.so
+#LoadModule disk_cache_module modules/mod_disk_cache.so
+#LoadModule file_cache_module modules/mod_file_cache.so
+#LoadModule mem_cache_module modules/mod_mem_cache.so
+LoadModule cgi_module modules/mod_cgi.so
+LoadModule ssl_module modules/mod_ssl.so
+LoadModule php5_module modules/libphp5.so
+
+#
+# The following modules are not loaded by default:
+#
+#LoadModule cern_meta_module modules/mod_cern_meta.so
+LoadModule asis_module modules/mod_asis.so
+
+#
+# Load config files from the config directory "/etc/httpd/conf.d".
+#
+#Include conf.d/*.conf
+
+#
+# ExtendedStatus controls whether Apache will generate "full" status
+# information (ExtendedStatus On) or just basic information (ExtendedStatus
+# Off) when the "server-status" handler is called. The default is Off.
+#
+#ExtendedStatus On
+
+#
+# If you wish httpd to run as a different user or group, you must run
+# httpd as root initially and it will switch.
+#
+# User/Group: The name (or #number) of the user/group to run httpd as.
+# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
+# . On HPUX you may not be able to use shared memory as nobody, and the
+# suggested workaround is to create a user www and use that user.
+# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
+# when the value of (unsigned)Group is above 60000;
+# don't use Group #-1 on these systems!
+#
+User apache
+Group apache
+
+### Section 2: 'Main' server configuration
+#
+# The directives in this section set up the values used by the 'main'
+# server, which responds to any requests that aren't handled by a
+# <VirtualHost> definition. These values also provide defaults for
+# any <VirtualHost> containers you may define later in the file.
+#
+# All of these directives may appear inside <VirtualHost> containers,
+# in which case these default settings will be overridden for the
+# virtual host being defined.
+#
+
+#
+# ServerAdmin: Your address, where problems with the server should be
+# e-mailed. This address appears on some server-generated pages, such
+# as error documents. e.g. admin@your-domain.com
+#
+ServerAdmin root@localhost
+
+#
+# ServerName gives the name and port that the server uses to identify itself.
+# This can often be determined automatically, but we recommend you specify
+# it explicitly to prevent problems during startup.
+#
+# If this is not set to valid DNS name for your host, server-generated
+# redirections will not work. See also the UseCanonicalName directive.
+#
+# If your host doesn't have a registered DNS name, enter its IP address here.
+# You will have to access it by its address anyway, and this will make
+# redirections work in a sensible way.
+#
+ServerName 127.0.0.1
+
+#
+# UseCanonicalName: Determines how Apache constructs self-referencing
+# URLs and the SERVER_NAME and SERVER_PORT variables.
+# When set "Off", Apache will use the Hostname and Port supplied
+# by the client. When set "On", Apache will use the value of the
+# ServerName directive.
+#
+UseCanonicalName On
+
+#
+# DocumentRoot: The directory out of which you will serve your
+# documents. By default, all requests are taken from this directory, but
+# symbolic links and aliases may be used to point to other locations.
+#
+#DocumentRoot "/var/www/html"
+
+#
+# Each directory to which Apache has access can be configured with respect
+# to which services and features are allowed and/or disabled in that
+# directory (and its subdirectories).
+#
+# Note that from this point forward you must specifically allow
+# particular features to be enabled - so if something's not working as
+# you might expect, make sure that you have specifically enabled it
+# below.
+#
+
+#
+# This should be changed to whatever you set DocumentRoot to.
+#
+<Directory />
+
+#
+# Possible values for the Options directive are "None", "All",
+# or any combination of:
+# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
+#
+# Note that "MultiViews" must be named *explicitly* --- "Options All"
+# doesn't give it to you.
+#
+# The Options directive is both complicated and important. Please see
+# http://httpd.apache.org/docs/2.2/mod/core.html#options
+# for more information.
+#
+ Options Indexes FollowSymLinks MultiViews ExecCGI Includes
+
+#
+# AllowOverride controls what directives may be placed in .htaccess files.
+# It can be "All", "None", or any combination of the keywords:
+# Options FileInfo AuthConfig Limit
+#
+ AllowOverride All
+
+#
+# Controls who can get stuff from this server.
+#
+ Order allow,deny
+ Allow from all
+
+</Directory>
+
+#
+#
+# Control access to UserDir directories. The following is an example
+# for a site where these directories are restricted to read-only.
+#
+#<Directory /home/*/public_html>
+# AllowOverride FileInfo AuthConfig Limit
+# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
+# <Limit GET POST OPTIONS>
+# Order allow,deny
+# Allow from all
+# </Limit>
+# <LimitExcept GET POST OPTIONS>
+# Order deny,allow
+# Deny from all
+# </LimitExcept>
+#</Directory>
+
+#
+# DirectoryIndex: sets the file that Apache will serve if a directory
+# is requested.
+#
+# The index.html.var file (a type-map) is used to deliver content-
+# negotiated documents. The MultiViews Option can be used for the
+# same purpose, but it is much slower.
+#
+#DirectoryIndex index.html index.html.var
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for additional configuration directives. See also the AllowOverride
+# directive.
+#
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess and .htpasswd files from being
+# viewed by Web clients.
+#
+<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+#
+# Apple specific filesystem protection.
+#
+
+<Files "rsrc">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+<Directory ~ ".*\.\.namedfork">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Directory>
+
+#
+# TypesConfig describes where the mime.types file (or equivalent) is
+# to be found.
+#
+TypesConfig /etc/mime.types
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+#
+# EnableMMAP: Control whether memory-mapping is used to deliver
+# files (assuming that the underlying OS supports it).
+# The default is on; turn this off if you serve from NFS-mounted
+# filesystems. On some systems, turning it off (regardless of
+# filesystem) can improve performance; for details, please see
+# http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
+#
+#EnableMMAP off
+
+#
+# EnableSendfile: Control whether the sendfile kernel support is
+# used to deliver files (assuming that the OS supports it).
+# The default is on; turn this off if you serve from NFS-mounted
+# filesystems. Please see
+# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
+#
+#EnableSendfile off
+
+#
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+#ErrorLog /tmp/WebKit/error_log
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+# "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this
+# requires the mod_logio module to be loaded.
+#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
+
+#
+# The location and format of the access logfile (Common Logfile Format).
+# If you do not define any access logfiles within a <VirtualHost>
+# container, they will be logged here. Contrariwise, if you *do*
+# define per-<VirtualHost> access logfiles, transactions will be
+# logged therein and *not* in this file.
+#
+#CustomLog logs/access_log common
+
+#
+# If you would like to have separate agent and referer logfiles, uncomment
+# the following directives.
+#
+#CustomLog logs/referer_log referer
+#CustomLog logs/agent_log agent
+
+#
+# For a single logfile with access, agent, and referer information
+# (Combined Logfile Format), use the following directive:
+#
+#CustomLog logs/access_log combined
+
+#
+# Optionally add a line containing the server version and virtual host
+# name to server-generated pages (internal error documents, FTP directory
+# listings, mod_status and mod_info output etc., but not CGI generated
+# documents or custom error documents).
+# Set to "EMail" to also include a mailto: link to the ServerAdmin.
+# Set to one of: On | Off | EMail
+#
+ServerSignature On
+
+#
+# Aliases: Add here as many aliases as you need (with no limit). The format is
+# Alias fakename realname
+#
+# Note that if you include a trailing / on fakename then the server will
+# require it to be present in the URL. So "/icons" isn't aliased in this
+# example, only "/icons/". If the fakename is slash-terminated, then the
+# realname must also be slash terminated, and if the fakename omits the
+# trailing slash, the realname must also omit it.
+#
+# We include the /icons/ alias for FancyIndexed directory listings. If you
+# do not use FancyIndexing, you may comment this out.
+#
+#
+# ScriptAlias: This controls which directories contain server scripts.
+# ScriptAliases are essentially the same as Aliases, except that
+# documents in the realname directory are treated as applications and
+# run by the server when requested rather than as documents sent to the client.
+# The same rules about trailing "/" apply to ScriptAlias directives as to
+# Alias.
+#
+
+#
+# Redirect allows you to tell clients about documents which used to exist in
+# your server's namespace, but do not anymore. This allows you to tell the
+# clients where to look for the relocated document.
+# Example:
+# Redirect permanent /foo http://www.example.com/bar
+
+#
+# Directives controlling the display of server-generated directory listings.
+#
+
+#
+# AddDescription allows you to place a short description after a file in
+# server-generated indexes. These are only displayed for FancyIndexed
+# directories.
+# Format: AddDescription "description" filename
+#
+#AddDescription "GZIP compressed document" .gz
+#AddDescription "tar archive" .tar
+#AddDescription "GZIP compressed tar archive" .tgz
+
+#
+# DefaultLanguage and AddLanguage allows you to specify the language of
+# a document. You can then use content negotiation to give a browser a
+# file in a language the user can understand.
+#
+# Specify a default language. This means that all data
+# going out without a specific language tag (see below) will
+# be marked with this one. You probably do NOT want to set
+# this unless you are sure it is correct for all cases.
+#
+# * It is generally better to not mark a page as
+# * being a certain language than marking it with the wrong
+# * language!
+#
+# DefaultLanguage nl
+#
+# Note 1: The suffix does not have to be the same as the language
+# keyword --- those with documents in Polish (whose net-standard
+# language code is pl) may wish to use "AddLanguage pl .po" to
+# avoid the ambiguity with the common suffix for perl scripts.
+#
+# Note 2: The example entries below illustrate that in some cases
+# the two character 'Language' abbreviation is not identical to
+# the two character 'Country' code for its country,
+# E.g. 'Danmark/dk' versus 'Danish/da'.
+#
+# Note 3: In the case of 'ltz' we violate the RFC by using a three char
+# specifier. There is 'work in progress' to fix this and get
+# the reference data for rfc1766 cleaned up.
+#
+# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
+# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
+# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
+# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
+# Norwegian (no) - Polish (pl) - Portugese (pt)
+# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
+# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
+#
+AddLanguage ca .ca
+AddLanguage cs .cz .cs
+AddLanguage da .dk
+AddLanguage de .de
+AddLanguage el .el
+AddLanguage en .en
+AddLanguage eo .eo
+AddLanguage es .es
+AddLanguage et .et
+AddLanguage fr .fr
+AddLanguage he .he
+AddLanguage hr .hr
+AddLanguage it .it
+AddLanguage ja .ja
+AddLanguage ko .ko
+AddLanguage ltz .ltz
+AddLanguage nl .nl
+AddLanguage nn .nn
+AddLanguage no .no
+AddLanguage pl .po
+AddLanguage pt .pt
+AddLanguage pt-BR .pt-br
+AddLanguage ru .ru
+AddLanguage sv .sv
+AddLanguage zh-CN .zh-cn
+AddLanguage zh-TW .zh-tw
+AddCharset Big5 .Big5 .big5
+AddCharset WINDOWS-1251 .cp-1251
+AddCharset CP866 .cp866
+AddCharset ISO-8859-5 .iso-ru
+AddCharset KOI8-R .koi8-r
+AddCharset UCS-2 .ucs2
+AddCharset UCS-4 .ucs4
+AddCharset UTF-8 .utf8
+
+#
+# LanguagePriority allows you to give precedence to some languages
+# in case of a tie during content negotiation.
+#
+# Just list the languages in decreasing order of preference. We have
+# more or less alphabetized them here. You probably want to change this.
+#
+<IfModule mod_negotiation.c>
+ LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
+</IfModule>
+
+#
+# ForceLanguagePriority allows you to serve a result page rather than
+# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
+# [in case no accepted languages matched the available variants]
+#
+#ForceLanguagePriority Prefer Fallback
+
+#
+# Specify a default charset for all content served; this enables
+# interpretation of all content as UTF-8 by default. To use the
+# default browser choice (ISO-8859-1), or to allow the META tags
+# in HTML content to override this choice, comment out this
+# directive:
+#
+#AddDefaultCharset UTF-8
+
+#
+# AddType allows you to add to or override the MIME configuration
+# file mime.types for specific file types.
+#
+#AddType application/x-tar .tgz
+
+#
+# AddEncoding allows you to have certain browsers uncompress
+# information on the fly. Note: Not all browsers support this.
+# Despite the name similarity, the following Add* directives have nothing
+# to do with the FancyIndexing customization directives above.
+#
+AddEncoding x-compress .Z
+AddEncoding x-gzip .gz .tgz
+
+# If the AddEncoding directives above are commented-out, then you
+# probably should define those extensions to indicate media types:
+#
+#AddType application/x-compress .Z
+#AddType application/x-gzip .gz .tgz
+
+#
+# MIME-types for downloading Certificates and CRLs
+#
+AddType application/x-x509-ca-cert .crt
+AddType application/x-pkcs7-crl .crl
+
+#
+# AddHandler allows you to map certain file extensions to "handlers":
+# actions unrelated to filetype. These can be either built into the server
+# or added with the Action directive (see below)
+#
+# To use CGI scripts outside of ScriptAliased directories:
+# (You will also need to add "ExecCGI" to the "Options" directive.)
+#
+AddHandler cgi-script .cgi .pl
+
+#
+# Filters allow you to process content before it is sent to the client.
+#
+# To parse .shtml files for server-side includes (SSI):
+# (You will also need to add "Includes" to the "Options" directive.)
+#
+AddType text/html .shtml
+AddOutputFilter INCLUDES .shtml
+
+#
+# For files that include their own HTTP headers:
+#
+AddHandler send-as-is asis
+
+#
+# For type maps (negotiated resources):
+# (This is enabled by default to allow the Apache "It Worked" page
+# to be distributed in multiple languages.)
+#
+#AddHandler type-map var
+
+#
+# Action lets you define media types that will execute a script whenever
+# a matching file is called. This eliminates the need for repeated URL
+# pathnames for oft-used CGI file processors.
+# Format: Action media/type /cgi-script/location
+# Format: Action handler-name /cgi-script/location
+#
+
+#
+# Customizable error responses come in three flavors:
+# 1) plain text 2) local redirects 3) external redirects
+#
+# Some examples:
+#ErrorDocument 500 "The server made a boo boo."
+#ErrorDocument 404 /missing.html
+#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
+#ErrorDocument 402 http://www.example.com/subscription_info.html
+#
+
+#
+# Putting this all together, we can internationalize error responses.
+#
+# We use Alias to redirect any /error/HTTP_<error>.html.var response to
+# our collection of by-error message multi-language collections. We use
+# includes to substitute the appropriate text.
+#
+# You can modify the messages' appearance without changing any of the
+# default HTTP_<error>.html.var files by adding the line:
+#
+# Alias /error/include/ "/your/include/path/"
+#
+# which allows you to create your own set of files by starting with the
+# /var/www/error/include/ files and
+# copying them to /your/include/path/, even on a per-VirtualHost basis.
+#
+
+#
+# The following directives modify normal HTTP response behavior to
+# handle known problems with browser implementations.
+#
+#BrowserMatch "Mozilla/2" nokeepalive
+#BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
+#BrowserMatch "RealPlayer 4\.0" force-response-1.0
+#BrowserMatch "Java/1\.0" force-response-1.0
+#BrowserMatch "JDK/1\.0" force-response-1.0
+
+#
+# The following directive disables redirects on non-GET requests for
+# a directory that does not include the trailing slash. This fixes a
+# problem with Microsoft WebFolders which does not appropriately handle
+# redirects for folders with DAV methods.
+# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
+#
+#BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
+#BrowserMatch "MS FrontPage" redirect-carefully
+#BrowserMatch "^WebDrive" redirect-carefully
+#BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
+#BrowserMatch "^gnome-vfs/1.0" redirect-carefully
+#BrowserMatch "^XML Spy" redirect-carefully
+#BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
+
+#
+# Allow server status reports generated by mod_status,
+# with the URL of http://servername/server-status
+# Change the ".example.com" to match your domain to enable.
+#
+#<Location /server-status>
+# SetHandler server-status
+# Order deny,allow
+# Deny from all
+# Allow from .example.com
+#</Location>
+
+#
+# Allow remote server configuration reports, with the URL of
+# http://servername/server-info (requires that mod_info.c be loaded).
+# Change the ".example.com" to match your domain to enable.
+#
+#<Location /server-info>
+# SetHandler server-info
+# Order deny,allow
+# Deny from all
+# Allow from .example.com
+#</Location>
+
+#
+# Proxy Server directives. Uncomment the following lines to
+# enable the proxy server:
+#
+#<IfModule mod_proxy.c>
+#ProxyRequests On
+#
+#<Proxy *>
+# Order deny,allow
+# Deny from all
+# Allow from .example.com
+#</Proxy>
+
+#
+# Enable/disable the handling of HTTP/1.1 "Via:" headers.
+# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
+# Set to one of: Off | On | Full | Block
+#
+#ProxyVia On
+
+#
+# To enable a cache of proxied content, uncomment the following lines.
+# See http://httpd.apache.org/docs/2.2/mod/mod_cache.html for more details.
+#
+#<IfModule mod_disk_cache.c>
+# CacheEnable disk /
+# CacheRoot "/var/cache/mod_proxy"
+#</IfModule>
+#
+
+#</IfModule>
+# End of proxy directives.
+
+### Section 3: Virtual Hosts
+#
+# VirtualHost: If you want to maintain multiple domains/hostnames on your
+# machine you can setup VirtualHost containers for them. Most configurations
+# use only name-based virtual hosts so the server doesn't need to worry about
+# IP addresses. This is indicated by the asterisks in the directives below.
+#
+# Please see the documentation at
+# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
+# for further details before you try to setup virtual hosts.
+#
+# You may use the command line option '-S' to verify your virtual host
+# configuration.
+
+#
+# Use name-based virtual hosting.
+#
+#NameVirtualHost *:80
+#
+# NOTE: NameVirtualHost cannot be used without a port specifier
+# (e.g. :80) if mod_ssl is being used, due to the nature of the
+# SSL protocol.
+#
+
+#
+# VirtualHost example:
+# Almost any Apache directive may go into a VirtualHost container.
+# The first VirtualHost section is used for requests without a known
+# server name.
+#
+#<VirtualHost *:80>
+# ServerAdmin webmaster@dummy-host.example.com
+# DocumentRoot /www/docs/dummy-host.example.com
+# ServerName dummy-host.example.com
+# ErrorLog logs/dummy-host.example.com-error_log
+# CustomLog logs/dummy-host.example.com-access_log common
+#</VirtualHost>
+
+<IfModule mod_php5.c>
+ # If php is turned on, we repsect .php and .phps files.
+ AddType application/x-httpd-php .php
+ AddType application/x-httpd-php .bat
+ AddType application/x-httpd-php-source .phps
+
+ # Since most users will want index.php to work we
+ # also automatically enable index.php
+ <IfModule mod_dir.c>
+ DirectoryIndex index.html index.php
+ </IfModule>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_METHOD} ^TRACE
+ RewriteRule .* - [F]
+</IfModule>
+
+<VirtualHost 127.0.0.1:8443>
+ ServerName 127.0.0.1
+ SSLEngine On
+</VirtualHost>
diff --git a/LayoutTests/http/conf/httpd.conf b/LayoutTests/http/conf/httpd.conf
new file mode 100644
index 0000000..ec04c73
--- /dev/null
+++ b/LayoutTests/http/conf/httpd.conf
@@ -0,0 +1,739 @@
+##
+## httpd.conf -- Apache HTTP server configuration file
+##
+
+#
+# Based upon the NCSA server configuration files originally by Rob McCool.
+#
+# This is the main Apache server configuration file. It contains the
+# configuration directives that give the server its instructions.
+# See <URL:http://httpd.apache.org/docs/> for detailed information about
+# the directives.
+#
+# Do NOT simply read the instructions in here without understanding
+# what they do. They're here only as hints or reminders. If you are unsure
+# consult the online docs. You have been warned.
+#
+# After this file is processed, the server will look for and process
+# /private/etc/httpd/srm.conf and then /private/etc/httpd/access.conf
+# unless you have overridden these with ResourceConfig and/or
+# AccessConfig directives here.
+#
+# The configuration directives are grouped into three basic sections:
+# 1. Directives that control the operation of the Apache server process as a
+# whole (the 'global environment').
+# 2. Directives that define the parameters of the 'main' or 'default' server,
+# which responds to requests that aren't handled by a virtual host.
+# These directives also provide default values for the settings
+# of all virtual hosts.
+# 3. Settings for virtual hosts, which allow Web requests to be sent to
+# different IP addresses or hostnames and have them handled by the
+# same Apache server process.
+#
+# Configuration and logfile names: If the filenames you specify for many
+# of the server's control files begin with "/" (or "drive:/" for Win32), the
+# server will use that explicit path. If the filenames do *not* begin
+# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
+# with ServerRoot set to "/usr/local/apache" will be interpreted by the
+# server as "/usr/local/apache/logs/foo.log".
+#
+
+### Section 1: Global Environment
+#
+# The directives in this section affect the overall operation of Apache,
+# such as the number of concurrent requests it can handle or where it
+# can find its configuration files.
+#
+
+#
+# ServerType is either inetd, or standalone. Inetd mode is only supported on
+# Unix platforms.
+#
+ServerType standalone
+
+#
+# ServerRoot: The top of the directory tree under which the server's
+# configuration, error, and log files are kept.
+#
+# NOTE! If you intend to place this on an NFS (or otherwise network)
+# mounted filesystem then please read the LockFile documentation
+# (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
+# you will save yourself a lot of trouble.
+#
+ServerRoot "/usr"
+
+#
+# The LockFile directive sets the path to the lockfile used when Apache
+# is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
+# USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
+# its default value. The main reason for changing it is if the logs
+# directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
+# DISK. The PID of the main server process is automatically appended to
+# the filename.
+#
+LockFile "/tmp/WebKit/httpd.lock"
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+PidFile "/tmp/WebKit/httpd.pid"
+
+#
+# ScoreBoardFile: File used to store internal server process information.
+# Not all architectures require this. But if yours does (you'll know because
+# this file will be created when you run Apache) then you *must* ensure that
+# no two invocations of Apache share the same scoreboard file.
+#
+ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
+
+#
+# In the standard configuration, the server will process httpd.conf (this
+# file, specified by the -f command line option), srm.conf, and access.conf
+# in that order. The latter two files are now distributed empty, as it is
+# recommended that all directives be kept in a single file for simplicity.
+# The commented-out values below are the built-in defaults. You can have the
+# server ignore these files altogether by using "/dev/null" (for Unix) or
+# "nul" (for Win32) for the arguments to the directives.
+#
+ResourceConfig /dev/null
+AccessConfig /dev/null
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout 300
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive On
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests 100
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout 15
+
+#
+# Server-pool size regulation. Rather than making you guess how many
+# server processes you need, Apache dynamically adapts to the load it
+# sees --- that is, it tries to maintain enough server processes to
+# handle the current load, plus a few spare servers to handle transient
+# load spikes (e.g., multiple simultaneous requests from a single
+# Netscape browser).
+#
+# It does this by periodically checking how many servers are waiting
+# for a request. If there are fewer than MinSpareServers, it creates
+# a new spare. If there are more than MaxSpareServers, some of the
+# spares die off. The default values are probably OK for most sites.
+#
+MinSpareServers 1
+MaxSpareServers 5
+
+#
+# Number of servers to start initially --- should be a reasonable ballpark
+# figure.
+#
+StartServers 1
+
+#
+# Limit on total number of servers running, i.e., limit on the number
+# of clients who can simultaneously connect --- if this limit is ever
+# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
+# It is intended mainly as a brake to keep a runaway server from taking
+# the system with it as it spirals down...
+#
+MaxClients 150
+
+#
+# MaxRequestsPerChild: the number of requests each child process is
+# allowed to process before the child dies. The child will exit so
+# as to avoid problems after prolonged use when Apache (and maybe the
+# libraries it uses) leak memory or other resources. On most systems, this
+# isn't really needed, but a few (such as Solaris) do have notable leaks
+# in the libraries. For these platforms, set to something like 10000
+# or so; a setting of 0 means unlimited.
+#
+# NOTE: This value does not include keepalive requests after the initial
+# request per connection. For example, if a child process handles
+# an initial request and 10 subsequent "keptalive" requests, it
+# would only count as 1 request towards this limit.
+#
+MaxRequestsPerChild 100000
+
+#
+# Listen: Allows you to bind Apache to specific IP addresses and/or
+# ports, instead of the default. See also the <VirtualHost>
+# directive.
+#
+# Configured from the httpd command line for WebKit layout tests.
+# Port 8443 is hard-coded as it is needed for the HTTPS configuration later on.
+#
+#Listen 3000
+Listen 127.0.0.1:8080
+Listen 127.0.0.1:8443
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+# To be able to use the functionality of a module which was built as a DSO you
+# have to place corresponding `LoadModule' lines at this location so the
+# directives contained in it are actually available _before_ they are used.
+# Please read the file http://httpd.apache.org/docs/dso.html for more
+# details about the DSO mechanism and run `httpd -l' for the list of already
+# built-in (statically linked and thus always available) modules in your httpd
+# binary.
+#
+# Note: The order in which modules are loaded is important. Don't change
+# the order below without expert advice.
+#
+# Example:
+# LoadModule foo_module libexec/mod_foo.so
+#LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so
+#LoadModule env_module libexec/httpd/mod_env.so
+LoadModule config_log_module libexec/httpd/mod_log_config.so
+#LoadModule mime_magic_module libexec/httpd/mod_mime_magic.so
+LoadModule mime_module libexec/httpd/mod_mime.so
+LoadModule negotiation_module libexec/httpd/mod_negotiation.so
+#LoadModule status_module libexec/httpd/mod_status.so
+#LoadModule info_module libexec/httpd/mod_info.so
+LoadModule includes_module libexec/httpd/mod_include.so
+#LoadModule autoindex_module libexec/httpd/mod_autoindex.so
+#LoadModule dir_module libexec/httpd/mod_dir.so
+LoadModule cgi_module libexec/httpd/mod_cgi.so
+LoadModule asis_module libexec/httpd/mod_asis.so
+LoadModule imap_module libexec/httpd/mod_imap.so
+LoadModule action_module libexec/httpd/mod_actions.so
+#LoadModule speling_module libexec/httpd/mod_speling.so
+#LoadModule userdir_module libexec/httpd/mod_userdir.so
+LoadModule alias_module libexec/httpd/mod_alias.so
+LoadModule rewrite_module libexec/httpd/mod_rewrite.so
+LoadModule access_module libexec/httpd/mod_access.so
+LoadModule auth_module libexec/httpd/mod_auth.so
+#LoadModule anon_auth_module libexec/httpd/mod_auth_anon.so
+#LoadModule dbm_auth_module libexec/httpd/mod_auth_dbm.so
+#LoadModule digest_module libexec/httpd/mod_digest.so
+#LoadModule proxy_module libexec/httpd/libproxy.so
+#LoadModule cern_meta_module libexec/httpd/mod_cern_meta.so
+#LoadModule expires_module libexec/httpd/mod_expires.so
+LoadModule headers_module libexec/httpd/mod_headers.so
+#LoadModule usertrack_module libexec/httpd/mod_usertrack.so
+#LoadModule log_forensic_module libexec/httpd/mod_log_forensic.so
+#LoadModule unique_id_module libexec/httpd/mod_unique_id.so
+#LoadModule setenvif_module libexec/httpd/mod_setenvif.so
+#LoadModule dav_module libexec/httpd/libdav.so
+LoadModule ssl_module libexec/httpd/libssl.so
+#LoadModule perl_module libexec/httpd/libperl.so
+LoadModule php4_module libexec/httpd/libphp4.so
+LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
+#LoadModule bonjour_module libexec/httpd/mod_bonjour.so
+
+# Reconstruction of the complete module list from all available modules
+# (static and shared ones) to achieve correct module execution order.
+# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
+ClearModuleList
+#AddModule mod_vhost_alias.c
+#AddModule mod_env.c
+AddModule mod_log_config.c
+#AddModule mod_mime_magic.c
+AddModule mod_mime.c
+AddModule mod_negotiation.c
+#AddModule mod_status.c
+#AddModule mod_info.c
+AddModule mod_include.c
+#AddModule mod_autoindex.c
+#AddModule mod_dir.c
+AddModule mod_cgi.c
+AddModule mod_asis.c
+AddModule mod_imap.c
+AddModule mod_actions.c
+#AddModule mod_speling.c
+#AddModule mod_userdir.c
+AddModule mod_alias.c
+AddModule mod_rewrite.c
+AddModule mod_access.c
+AddModule mod_auth.c
+#AddModule mod_auth_anon.c
+#AddModule mod_auth_dbm.c
+#AddModule mod_digest.c
+#AddModule mod_proxy.c
+#AddModule mod_cern_meta.c
+#AddModule mod_expires.c
+AddModule mod_headers.c
+#AddModule mod_usertrack.c
+#AddModule mod_log_forensic.c
+#AddModule mod_unique_id.c
+AddModule mod_so.c
+#AddModule mod_setenvif.c
+#AddModule mod_dav.c
+AddModule mod_ssl.c
+#AddModule mod_perl.c
+AddModule mod_php4.c
+AddModule mod_hfs_apple.c
+#AddModule mod_bonjour.c
+
+### Section 2: 'Main' server configuration
+#
+# The directives in this section set up the values used by the 'main'
+# server, which responds to any requests that aren't handled by a
+# <VirtualHost> definition. These values also provide defaults for
+# any <VirtualHost> containers you may define later in the file.
+#
+# All of these directives may appear inside <VirtualHost> containers,
+# in which case these default settings will be overridden for the
+# virtual host being defined.
+#
+
+#
+# ServerName allows you to set a host name which is sent back to clients for
+# your server if it's different than the one the program would get (i.e., use
+# "www" instead of the host's real name).
+#
+# Note: You cannot just invent host names and hope they work. The name you
+# define here must be a valid DNS name for your host. If you don't understand
+# this, ask your network administrator.
+# If your host doesn't have a registered DNS name, enter its IP address here.
+# You will have to access it by its address (e.g., http://123.45.67.89/)
+# anyway, and this will make redirections work in a sensible way.
+#
+# 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your
+# machine always knows itself by this address. If you use Apache strictly for
+# local testing and development, you may use 127.0.0.1 as the server name.
+#
+ServerName 127.0.0.1
+
+#
+# DocumentRoot: The directory out of which you will serve your
+# documents. By default, all requests are taken from this directory, but
+# symbolic links and aliases may be used to point to other locations.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#DocumentRoot "/Library/WebServer/Documents"
+
+#
+# Each directory to which Apache has access, can be configured with respect
+# to which services and features are allowed and/or disabled in that
+# directory (and its subdirectories).
+#
+<Directory />
+#
+# This may also be "None", "All", or any combination of "Indexes",
+# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
+#
+# Note that "MultiViews" must be named *explicitly* --- "Options All"
+# doesn't give it to you.
+#
+ Options Indexes FollowSymLinks MultiViews ExecCGI Includes
+
+#
+# This controls which options the .htaccess files in directories can
+# override. Can also be "All", or any combination of "Options", "FileInfo",
+# "AuthConfig", and "Limit"
+#
+ AllowOverride All
+
+#
+# Controls who can get stuff from this server.
+#
+ Order allow,deny
+ Allow from all
+</Directory>
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for access control information.
+#
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess files from being viewed by
+# Web clients. Since .htaccess files often contain authorization
+# information, access is disallowed for security reasons. Comment
+# these lines out if you want Web visitors to see the contents of
+# .htaccess files. If you change the AccessFileName directive above,
+# be sure to make the corresponding changes here.
+#
+# Also, folks tend to use names such as .htpasswd for password
+# files, so this will protect those as well.
+#
+<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+#
+# Apple specific filesystem protection.
+#
+
+<Files "rsrc">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Files>
+
+<Directory ~ ".*\.\.namedfork">
+ Order allow,deny
+ Deny from all
+ Satisfy All
+</Directory>
+
+#
+# CacheNegotiatedDocs: By default, Apache sends "Pragma: no-cache" with each
+# document that was negotiated on the basis of content. This asks proxy
+# servers not to cache the document. Uncommenting the following line disables
+# this behavior, and proxies will be allowed to cache the documents.
+#
+#CacheNegotiatedDocs
+
+#
+# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
+# Apache needs to construct a self-referencing URL (a URL that refers back
+# to the server the response is coming from) it will use ServerName and
+# Port to form a "canonical" name. With this setting off, Apache will
+# use the hostname:port that the client supplied, when possible. This
+# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
+#
+UseCanonicalName On
+
+#
+# TypesConfig describes where the mime.types file (or equivalent) is
+# to be found.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#
+#<IfModule mod_mime.c>
+# TypesConfig /private/etc/httpd/mime.types
+#</IfModule>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+#
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#ErrorLog "/tmp/layout-test-results/error_log"
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+#
+# The location and format of the access logfile (Common Logfile Format).
+# If you do not define any access logfiles within a <VirtualHost>
+# container, they will be logged here. Contrariwise, if you *do*
+# define per-<VirtualHost> access logfiles, transactions will be
+# logged therein and *not* in this file.
+#
+# Configured from the httpd command line for WebKit layout tests.
+#CustomLog "/tmp/layout-test-results/access_log" common
+
+#
+# If you prefer a single logfile with access, agent, and referer information
+# (Combined Logfile Format) you can use the following directive.
+#
+#CustomLog "/tmp/layout-test-results/access_log" combined
+
+#
+# Optionally add a line containing the server version and virtual host
+# name to server-generated pages (error documents, FTP directory listings,
+# mod_status and mod_info output etc., but not CGI generated documents).
+# Set to "EMail" to also include a mailto: link to the ServerAdmin.
+# Set to one of: On | Off | EMail
+#
+ServerSignature On
+
+#
+# Aliases: Add here as many aliases as you need (with no limit). The format is
+# Alias fakename realname
+#
+<IfModule mod_alias.c>
+</IfModule>
+# End of aliases.
+
+#
+# Redirect allows you to tell clients about documents which used to exist in
+# your server's namespace, but do not anymore. This allows you to tell the
+# clients where to look for the relocated document.
+# Format: Redirect old-URI new-URL
+#
+
+#
+# Document types.
+#
+<IfModule mod_mime.c>
+
+ #
+ # AddLanguage allows you to specify the language of a document. You can
+ # then use content negotiation to give a browser a file in a language
+ # it can understand.
+ #
+ # Note 1: The suffix does not have to be the same as the language
+ # keyword --- those with documents in Polish (whose net-standard
+ # language code is pl) may wish to use "AddLanguage pl .po" to
+ # avoid the ambiguity with the common suffix for perl scripts.
+ #
+ # Note 2: The example entries below illustrate that in quite
+ # some cases the two character 'Language' abbreviation is not
+ # identical to the two character 'Country' code for its country,
+ # E.g. 'Danmark/dk' versus 'Danish/da'.
+ #
+ # Note 3: In the case of 'ltz' we violate the RFC by using a three char
+ # specifier. But there is 'work in progress' to fix this and get
+ # the reference data for rfc1766 cleaned up.
+ #
+ # Danish (da) - Dutch (nl) - English (en) - Estonian (ee)
+ # French (fr) - German (de) - Greek-Modern (el)
+ # Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)
+ # Portugese (pt) - Luxembourgeois* (ltz)
+ # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
+ # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
+ # Russian (ru)
+ #
+ AddLanguage da .dk
+ AddLanguage nl .nl
+ AddLanguage en .en
+ AddLanguage et .ee
+ AddLanguage fr .fr
+ AddLanguage de .de
+ AddLanguage el .el
+ AddLanguage he .he
+ AddCharset ISO-8859-8 .iso8859-8
+ AddLanguage it .it
+ AddLanguage ja .ja
+ AddCharset ISO-2022-JP .jis
+ AddLanguage kr .kr
+ AddCharset ISO-2022-KR .iso-kr
+ AddLanguage nn .nn
+ AddLanguage no .no
+ AddLanguage pl .po
+ AddCharset ISO-8859-2 .iso-pl
+ AddLanguage pt .pt
+ AddLanguage pt-br .pt-br
+ AddLanguage ltz .lu
+ AddLanguage ca .ca
+ AddLanguage es .es
+ AddLanguage sv .sv
+ AddLanguage cs .cz .cs
+ AddLanguage ru .ru
+ AddLanguage zh-TW .zh-tw
+ AddCharset Big5 .Big5 .big5
+ AddCharset WINDOWS-1251 .cp-1251
+ AddCharset CP866 .cp866
+ AddCharset ISO-8859-5 .iso-ru
+ AddCharset KOI8-R .koi8-r
+ AddCharset UCS-2 .ucs2
+ AddCharset UCS-4 .ucs4
+ AddCharset UTF-8 .utf8
+
+ # LanguagePriority allows you to give precedence to some languages
+ # in case of a tie during content negotiation.
+ #
+ # Just list the languages in decreasing order of preference. We have
+ # more or less alphabetized them here. You probably want to change this.
+ #
+ <IfModule mod_negotiation.c>
+ LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
+ </IfModule>
+
+ #
+ # AddType allows you to tweak mime.types without actually editing it, or to
+ # make certain files to be certain types.
+ #
+ AddType application/x-tar .tgz
+
+ #
+ # AddEncoding allows you to have certain browsers uncompress
+ # information on the fly. Note: Not all browsers support this.
+ # Despite the name similarity, the following Add* directives have nothing
+ # to do with the FancyIndexing customization directives above.
+ #
+ AddEncoding x-compress .Z
+ AddEncoding x-gzip .gz .tgz
+ #
+ # If the AddEncoding directives above are commented-out, then you
+ # probably should define those extensions to indicate media types:
+ #
+ #AddType application/x-compress .Z
+ #AddType application/x-gzip .gz .tgz
+
+ #
+ # AddHandler allows you to map certain file extensions to "handlers",
+ # actions unrelated to filetype. These can be either built into the server
+ # or added with the Action command (see below)
+ #
+ # If you want to use server side includes, or CGI outside
+ # ScriptAliased directories, uncomment the following lines.
+ #
+ # To use CGI scripts:
+ #
+ AddHandler cgi-script .cgi .pl
+
+ #
+ # To use server-parsed HTML files
+ #
+ AddType text/html .shtml
+ AddHandler server-parsed .shtml
+
+ #
+ # Uncomment the following line to enable Apache's send-asis HTTP file
+ # feature
+ #
+ AddHandler send-as-is asis
+
+ #
+ # If you wish to use server-parsed imagemap files, use
+ #
+ #AddHandler imap-file map
+
+ #
+ # To enable type maps, you might want to use
+ #
+ #AddHandler type-map var
+
+</IfModule>
+# End of document types.
+
+#
+# Action lets you define media types that will execute a script whenever
+# a matching file is called. This eliminates the need for repeated URL
+# pathnames for oft-used CGI file processors.
+# Format: Action media/type /cgi-script/location
+# Format: Action handler-name /cgi-script/location
+#
+
+#
+# MetaDir: specifies the name of the directory in which Apache can find
+# meta information files. These files contain additional HTTP headers
+# to include when sending the document
+#
+#MetaDir .web
+
+#
+# MetaSuffix: specifies the file name suffix for the file containing the
+# meta information.
+#
+#MetaSuffix .meta
+
+#
+# Customizable error response (Apache style)
+# these come in three flavors
+#
+# 1) plain text
+#ErrorDocument 500 "The server made a boo boo.
+# n.b. the single leading (") marks it as text, it does not get output
+#
+# 2) local redirects
+#ErrorDocument 404 /missing.html
+# to redirect to local URL /missing.html
+#ErrorDocument 404 /cgi-bin/missing_handler.pl
+# N.B.: You can redirect to a script or a document using server-side-includes.
+#
+# 3) external redirects
+#ErrorDocument 402 http://some.other-server.com/subscription_info.html
+# N.B.: Many of the environment variables associated with the original
+# request will *not* be available to such a script.
+
+#
+# Proxy Server directives. Uncomment the following lines to
+# enable the proxy server:
+#
+#<IfModule mod_proxy.c>
+# ProxyRequests On
+
+# <Directory proxy:*>
+# Order deny,allow
+# Deny from all
+# Allow from .your-domain.com
+# </Directory>
+
+ #
+ # Enable/disable the handling of HTTP/1.1 "Via:" headers.
+ # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
+ # Set to one of: Off | On | Full | Block
+ #
+# ProxyVia On
+
+ #
+ # To enable the cache as well, edit and uncomment the following lines:
+ # (no cacheing without CacheRoot)
+ #
+# CacheRoot "/private/var/run/proxy"
+# CacheSize 5
+# CacheGcInterval 4
+# CacheMaxExpire 24
+# CacheLastModifiedFactor 0.1
+# CacheDefaultExpire 1
+# NoCache a-domain.com another-domain.edu joes.garage-sale.com
+
+#</IfModule>
+# End of proxy directives.
+
+
+<IfModule mod_php4.c>
+ # If php is turned on, we repsect .php and .phps files.
+ AddType application/x-httpd-php .php
+ AddType application/x-httpd-php .bat
+ AddType application/x-httpd-php-source .phps
+
+ # Since most users will want index.php to work we
+ # also automatically enable index.php
+ <IfModule mod_dir.c>
+ DirectoryIndex index.html index.php
+ </IfModule>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{REQUEST_METHOD} ^TRACE
+ RewriteRule .* - [F]
+</IfModule>
+
+<VirtualHost 127.0.0.1:8443>
+ ServerName 127.0.0.1
+ SSLEngine On
+</VirtualHost>
diff --git a/LayoutTests/http/conf/libphp4.dll b/LayoutTests/http/conf/libphp4.dll
new file mode 100755
index 0000000..0127b7d
--- /dev/null
+++ b/LayoutTests/http/conf/libphp4.dll
Binary files differ
diff --git a/LayoutTests/http/conf/mime.types b/LayoutTests/http/conf/mime.types
new file mode 100644
index 0000000..cfb9d53
--- /dev/null
+++ b/LayoutTests/http/conf/mime.types
@@ -0,0 +1,600 @@
+# This is a comment. I love comments.
+
+# This file controls what Internet media types are sent to the client for
+# given file extension(s). Sending the correct media type to the client
+# is important so they know how to handle the content of the file.
+# Extra types can either be added here or by using an AddType directive
+# in your config files. For more information about Internet media types,
+# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
+# registry is at <http://www.iana.org/assignments/media-types/>.
+
+# MIME type Extensions
+application/activemessage
+application/andrew-inset ez
+application/applefile
+application/atom+xml atom
+application/atomicmail
+application/batch-smtp
+application/beep+xml
+application/cals-1840
+application/cnrp+xml
+application/commonground
+application/cpl+xml
+application/cybercash
+application/dca-rft
+application/dec-dx
+application/dvcs
+application/edi-consent
+application/edifact
+application/edi-x12
+application/eshop
+application/font-tdpfr
+application/http
+application/hyperstudio
+application/iges
+application/index
+application/index.cmd
+application/index.obj
+application/index.response
+application/index.vnd
+application/iotp
+application/ipp
+application/isup
+application/mac-binhex40 hqx
+application/mac-compactpro cpt
+application/macwriteii
+application/marc
+application/mathematica
+application/mathml+xml mathml
+application/msword doc
+application/news-message-id
+application/news-transmission
+application/ocsp-request
+application/ocsp-response
+application/octet-stream bin dms lha lzh exe class so dll dmg
+application/oda oda
+application/ogg ogg
+application/parityfec
+application/pdf pdf
+application/pgp-encrypted
+application/pgp-keys
+application/pgp-signature
+application/pkcs10
+application/pkcs7-mime
+application/pkcs7-signature
+application/pkix-cert
+application/pkix-crl
+application/pkixcmp
+application/postscript ai eps ps
+application/prs.alvestrand.titrax-sheet
+application/prs.cww
+application/prs.nprend
+application/prs.plucker
+application/qsig
+application/rdf+xml rdf
+application/reginfo+xml
+application/remote-printing
+application/riscos
+application/rtf
+application/sdp
+application/set-payment
+application/set-payment-initiation
+application/set-registration
+application/set-registration-initiation
+application/sgml
+application/sgml-open-catalog
+application/sieve
+application/slate
+application/smil smi smil
+application/srgs gram
+application/srgs+xml grxml
+application/timestamp-query
+application/timestamp-reply
+application/tve-trigger
+application/vemmi
+application/vnd.3gpp.pic-bw-large
+application/vnd.3gpp.pic-bw-small
+application/vnd.3gpp.pic-bw-var
+application/vnd.3gpp.sms
+application/vnd.3m.post-it-notes
+application/vnd.accpac.simply.aso
+application/vnd.accpac.simply.imp
+application/vnd.acucobol
+application/vnd.acucorp
+application/vnd.adobe.xfdf
+application/vnd.aether.imp
+application/vnd.amiga.ami
+application/vnd.anser-web-certificate-issue-initiation
+application/vnd.anser-web-funds-transfer-initiation
+application/vnd.audiograph
+application/vnd.blueice.multipass
+application/vnd.bmi
+application/vnd.businessobjects
+application/vnd.canon-cpdl
+application/vnd.canon-lips
+application/vnd.cinderella
+application/vnd.claymore
+application/vnd.commerce-battelle
+application/vnd.commonspace
+application/vnd.contact.cmsg
+application/vnd.cosmocaller
+application/vnd.criticaltools.wbs+xml
+application/vnd.ctc-posml
+application/vnd.cups-postscript
+application/vnd.cups-raster
+application/vnd.cups-raw
+application/vnd.curl
+application/vnd.cybank
+application/vnd.data-vision.rdz
+application/vnd.dna
+application/vnd.dpgraph
+application/vnd.dreamfactory
+application/vnd.dxr
+application/vnd.ecdis-update
+application/vnd.ecowin.chart
+application/vnd.ecowin.filerequest
+application/vnd.ecowin.fileupdate
+application/vnd.ecowin.series
+application/vnd.ecowin.seriesrequest
+application/vnd.ecowin.seriesupdate
+application/vnd.enliven
+application/vnd.epson.esf
+application/vnd.epson.msf
+application/vnd.epson.quickanime
+application/vnd.epson.salt
+application/vnd.epson.ssf
+application/vnd.ericsson.quickcall
+application/vnd.eudora.data
+application/vnd.fdf
+application/vnd.ffsns
+application/vnd.fints
+application/vnd.flographit
+application/vnd.framemaker
+application/vnd.fsc.weblaunch
+application/vnd.fujitsu.oasys
+application/vnd.fujitsu.oasys2
+application/vnd.fujitsu.oasys3
+application/vnd.fujitsu.oasysgp
+application/vnd.fujitsu.oasysprs
+application/vnd.fujixerox.ddd
+application/vnd.fujixerox.docuworks
+application/vnd.fujixerox.docuworks.binder
+application/vnd.fut-misnet
+application/vnd.grafeq
+application/vnd.groove-account
+application/vnd.groove-help
+application/vnd.groove-identity-message
+application/vnd.groove-injector
+application/vnd.groove-tool-message
+application/vnd.groove-tool-template
+application/vnd.groove-vcard
+application/vnd.hbci
+application/vnd.hhe.lesson-player
+application/vnd.hp-hpgl
+application/vnd.hp-hpid
+application/vnd.hp-hps
+application/vnd.hp-pcl
+application/vnd.hp-pclxl
+application/vnd.httphone
+application/vnd.hzn-3d-crossword
+application/vnd.ibm.afplinedata
+application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay
+application/vnd.ibm.modcap
+application/vnd.ibm.rights-management
+application/vnd.ibm.secure-container
+application/vnd.informix-visionary
+application/vnd.intercon.formnet
+application/vnd.intertrust.digibox
+application/vnd.intertrust.nncp
+application/vnd.intu.qbo
+application/vnd.intu.qfx
+application/vnd.irepository.package+xml
+application/vnd.is-xpr
+application/vnd.japannet-directory-service
+application/vnd.japannet-jpnstore-wakeup
+application/vnd.japannet-payment-wakeup
+application/vnd.japannet-registration
+application/vnd.japannet-registration-wakeup
+application/vnd.japannet-setstore-wakeup
+application/vnd.japannet-verification
+application/vnd.japannet-verification-wakeup
+application/vnd.jisp
+application/vnd.kde.karbon
+application/vnd.kde.kchart
+application/vnd.kde.kformula
+application/vnd.kde.kivio
+application/vnd.kde.kontour
+application/vnd.kde.kpresenter
+application/vnd.kde.kspread
+application/vnd.kde.kword
+application/vnd.kenameaapp
+application/vnd.koan
+application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop
+application/vnd.llamagraphics.life-balance.exchange+xml
+application/vnd.lotus-1-2-3
+application/vnd.lotus-approach
+application/vnd.lotus-freelance
+application/vnd.lotus-notes
+application/vnd.lotus-organizer
+application/vnd.lotus-screencam
+application/vnd.lotus-wordpro
+application/vnd.mcd
+application/vnd.mediastation.cdkey
+application/vnd.meridian-slingshot
+application/vnd.micrografx.flo
+application/vnd.micrografx.igx
+application/vnd.mif mif
+application/vnd.minisoft-hp3000-save
+application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf
+application/vnd.mobius.dis
+application/vnd.mobius.mbk
+application/vnd.mobius.mqy
+application/vnd.mobius.msl
+application/vnd.mobius.plc
+application/vnd.mobius.txf
+application/vnd.mophun.application
+application/vnd.mophun.certificate
+application/vnd.motorola.flexsuite
+application/vnd.motorola.flexsuite.adsi
+application/vnd.motorola.flexsuite.fis
+application/vnd.motorola.flexsuite.gotap
+application/vnd.motorola.flexsuite.kmr
+application/vnd.motorola.flexsuite.ttc
+application/vnd.motorola.flexsuite.wem
+application/vnd.mozilla.xul+xml xul
+application/vnd.ms-artgalry
+application/vnd.ms-asf
+application/vnd.ms-excel xls
+application/vnd.ms-lrm
+application/vnd.ms-powerpoint ppt
+application/vnd.ms-project
+application/vnd.ms-tnef
+application/vnd.ms-works
+application/vnd.ms-wpl
+application/vnd.mseq
+application/vnd.msign
+application/vnd.music-niff
+application/vnd.musician
+application/vnd.netfpx
+application/vnd.noblenet-directory
+application/vnd.noblenet-sealer
+application/vnd.noblenet-web
+application/vnd.novadigm.edm
+application/vnd.novadigm.edx
+application/vnd.novadigm.ext
+application/vnd.obn
+application/vnd.osa.netdeploy
+application/vnd.palm
+application/vnd.pg.format
+application/vnd.pg.osasli
+application/vnd.powerbuilder6
+application/vnd.powerbuilder6-s
+application/vnd.powerbuilder7
+application/vnd.powerbuilder7-s
+application/vnd.powerbuilder75
+application/vnd.powerbuilder75-s
+application/vnd.previewsystems.box
+application/vnd.publishare-delta-tree
+application/vnd.pvi.ptid1
+application/vnd.pwg-multiplexed
+application/vnd.pwg-xhtml-print+xml
+application/vnd.quark.quarkxpress
+application/vnd.rapid
+application/vnd.rn-realmedia rm
+application/vnd.s3sms
+application/vnd.sealed.net
+application/vnd.seemail
+application/vnd.shana.informed.formdata
+application/vnd.shana.informed.formtemplate
+application/vnd.shana.informed.interchange
+application/vnd.shana.informed.package
+application/vnd.smaf
+application/vnd.sss-cod
+application/vnd.sss-dtf
+application/vnd.sss-ntf
+application/vnd.street-stream
+application/vnd.svd
+application/vnd.swiftview-ics
+application/vnd.triscape.mxs
+application/vnd.trueapp
+application/vnd.truedoc
+application/vnd.ufdl
+application/vnd.uplanet.alert
+application/vnd.uplanet.alert-wbxml
+application/vnd.uplanet.bearer-choice
+application/vnd.uplanet.bearer-choice-wbxml
+application/vnd.uplanet.cacheop
+application/vnd.uplanet.cacheop-wbxml
+application/vnd.uplanet.channel
+application/vnd.uplanet.channel-wbxml
+application/vnd.uplanet.list
+application/vnd.uplanet.list-wbxml
+application/vnd.uplanet.listcmd
+application/vnd.uplanet.listcmd-wbxml
+application/vnd.uplanet.signal
+application/vnd.vcx
+application/vnd.vectorworks
+application/vnd.vidsoft.vidconference
+application/vnd.visio
+application/vnd.visionary
+application/vnd.vividence.scriptfile
+application/vnd.vsf
+application/vnd.wap.sic
+application/vnd.wap.slc
+application/vnd.wap.wbxml wbxml
+application/vnd.wap.wmlc wmlc
+application/vnd.wap.wmlscriptc wmlsc
+application/vnd.webturbo
+application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf
+application/vnd.wv.csp+wbxml
+application/vnd.xara
+application/vnd.xfdl
+application/vnd.yamaha.hv-dic
+application/vnd.yamaha.hv-script
+application/vnd.yamaha.hv-voice
+application/vnd.yellowriver-custom-menu
+application/voicexml+xml vxml
+application/watcherinfo+xml
+application/whoispp-query
+application/whoispp-response
+application/wita
+application/wordperfect5.1
+application/x-bcpio bcpio
+application/x-cdlink vcd
+application/x-chess-pgn pgn
+application/x-compress
+application/x-cpio cpio
+application/x-csh csh
+application/x-director dcr dir dxr
+application/x-dvi dvi
+application/x-futuresplash spl
+application/x-gtar gtar
+application/x-gzip
+application/x-hdf hdf
+application/x-javascript js
+application/x-java-jnlp-file jnlp
+application/x-koan skp skd skt skm
+application/x-latex latex
+application/x-netcdf nc cdf
+application/x-sh sh
+application/x-shar shar
+application/x-shockwave-flash swf
+application/x-stuffit sit
+application/x-sv4cpio sv4cpio
+application/x-sv4crc sv4crc
+application/x-tar tar
+application/x-tcl tcl
+application/x-tex tex
+application/x-texinfo texinfo texi
+application/x-troff t tr roff
+application/x-troff-man man
+application/x-troff-me me
+application/x-troff-ms ms
+application/x-ustar ustar
+application/x-wais-source src
+application/x400-bp
+application/xhtml+xml xhtml xht
+application/xslt+xml xslt
+application/xml xml xsl
+application/xml-dtd dtd
+application/xml-external-parsed-entity
+application/zip zip
+audio/32kadpcm
+audio/amr
+audio/amr-wb
+audio/basic au snd
+audio/cn
+audio/dat12
+audio/dsr-es201108
+audio/dvi4
+audio/evrc
+audio/evrc0
+audio/g722
+audio/g.722.1
+audio/g723
+audio/g726-16
+audio/g726-24
+audio/g726-32
+audio/g726-40
+audio/g728
+audio/g729
+audio/g729D
+audio/g729E
+audio/gsm
+audio/gsm-efr
+audio/l8
+audio/l16
+audio/l20
+audio/l24
+audio/lpc
+audio/midi mid midi kar
+audio/mpa
+audio/mpa-robust
+audio/mp4a-latm m4a m4p
+audio/mpeg mpga mp2 mp3
+audio/parityfec
+audio/pcma
+audio/pcmu
+audio/prs.sid
+audio/qcelp
+audio/red
+audio/smv
+audio/smv0
+audio/telephone-event
+audio/tone
+audio/vdvi
+audio/vnd.3gpp.iufp
+audio/vnd.cisco.nse
+audio/vnd.cns.anp1
+audio/vnd.cns.inf1
+audio/vnd.digital-winds
+audio/vnd.everad.plj
+audio/vnd.lucent.voice
+audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800
+audio/vnd.nuera.ecelp7470
+audio/vnd.nuera.ecelp9600
+audio/vnd.octel.sbc
+audio/vnd.qcelp
+audio/vnd.rhetorex.32kadpcm
+audio/vnd.vmx.cvsd
+audio/x-aiff aif aiff aifc
+audio/x-alaw-basic
+audio/x-mpegurl m3u
+audio/x-pn-realaudio ram ra
+audio/x-pn-realaudio-plugin
+audio/x-wav wav
+chemical/x-pdb pdb
+chemical/x-xyz xyz
+image/bmp bmp
+image/cgm cgm
+image/g3fax
+image/gif gif
+image/ief ief
+image/jpeg jpeg jpg jpe
+image/jp2 jp2
+image/naplps
+image/pict pict pic pct
+image/png png
+image/prs.btif
+image/prs.pti
+image/svg+xml svg
+image/t38
+image/tiff tiff tif
+image/tiff-fx
+image/vnd.cns.inf2
+image/vnd.djvu djvu djv
+image/vnd.dwg
+image/vnd.dxf
+image/vnd.fastbidsheet
+image/vnd.fpx
+image/vnd.fst
+image/vnd.fujixerox.edmics-mmr
+image/vnd.fujixerox.edmics-rlc
+image/vnd.globalgraphics.pgb
+image/vnd.mix
+image/vnd.ms-modi
+image/vnd.net-fpx
+image/vnd.svf
+image/vnd.wap.wbmp wbmp
+image/vnd.xiff
+image/x-cmu-raster ras
+image/x-macpaint pntg pnt mac
+image/x-icon ico
+image/x-portable-anymap pnm
+image/x-portable-bitmap pbm
+image/x-portable-graymap pgm
+image/x-portable-pixmap ppm
+image/x-quicktime qtif qti
+image/x-rgb rgb
+image/x-xbitmap xbm
+image/x-xpixmap xpm
+image/x-xwindowdump xwd
+message/delivery-status
+message/disposition-notification
+message/external-body
+message/http
+message/news
+message/partial
+message/rfc822
+message/s-http
+message/sip
+message/sipfrag
+model/iges igs iges
+model/mesh msh mesh silo
+model/vnd.dwf
+model/vnd.flatland.3dml
+model/vnd.gdl
+model/vnd.gs-gdl
+model/vnd.gtw
+model/vnd.mts
+model/vnd.parasolid.transmit.binary
+model/vnd.parasolid.transmit.text
+model/vnd.vtu
+model/vrml wrl vrml
+multipart/alternative
+multipart/appledouble
+multipart/byteranges
+multipart/digest
+multipart/encrypted
+multipart/form-data
+multipart/header-set
+multipart/mixed
+multipart/parallel
+multipart/related
+multipart/report
+multipart/signed
+multipart/voice-message
+text/cache-manifest manifest
+text/calendar ics ifb
+text/css css
+text/directory
+text/enriched
+text/html html htm
+text/parityfec
+text/plain asc txt
+text/prs.lines.tag
+text/rfc822-headers
+text/richtext rtx
+text/rtf rtf
+text/sgml sgml sgm
+text/t140
+text/tab-separated-values tsv
+text/uri-list
+text/vnd.abc
+text/vnd.curl
+text/vnd.dmclientscript
+text/vnd.fly
+text/vnd.fmi.flexstor
+text/vnd.in3d.3dml
+text/vnd.in3d.spot
+text/vnd.iptc.nitf
+text/vnd.iptc.newsml
+text/vnd.latex-z
+text/vnd.motorola.reflex
+text/vnd.ms-mediapackage
+text/vnd.net2phone.commcenter.command
+text/vnd.sun.j2me.app-descriptor
+text/vnd.wap.si
+text/vnd.wap.sl
+text/vnd.wap.wml wml
+text/vnd.wap.wmlscript wmls
+text/x-setext etx
+text/xml
+text/xml-external-parsed-entity
+video/bmpeg
+video/bt656
+video/celb
+video/dv
+video/h261
+video/h263
+video/h263-1998
+video/h263-2000
+video/jpeg
+video/mp1s
+video/mp2p
+video/mp2t
+video/mp4 mp4
+video/mp4v-es
+video/mpv
+video/mpeg mpeg mpg mpe
+video/nv
+video/parityfec
+video/pointer
+video/quicktime qt mov
+video/smpte292m
+video/vnd.fvt
+video/vnd.motorola.video
+video/vnd.motorola.videop
+video/vnd.mpegurl mxu m4u
+video/vnd.nokia.interleaved-multimedia
+video/vnd.objectvideo
+video/vnd.vivo
+video/x-dv dv dif
+video/x-msvideo avi
+video/x-sgi-movie movie
+x-conference/x-cooltalk ice
diff --git a/LayoutTests/http/conf/webkit-httpd.pem b/LayoutTests/http/conf/webkit-httpd.pem
new file mode 100644
index 0000000..37893b8
--- /dev/null
+++ b/LayoutTests/http/conf/webkit-httpd.pem
@@ -0,0 +1,28 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQCmcXbusrr8zQr8snIb0OVQibVfgv7zPjh/5xdcrKOejJzp3epA
+AF4TITeFR9vzWIwkmkcRoY+IbQNhh7kefGUYD47bvVamJMtq5cGYVs0HngT+KTMa
+NGH/G44KkFIOaz/b5d/JNKONrlqwxqXS+m6IY4l/E1Ff25ZjND5TaEvI1wIDAQAB
+AoGBAIcDv4A9h6UOBv2ZGyspNvsv2erSblGOhXJrWO4aNNemJJspIp4sLiPCbDE3
+a1po17XRWBkbPz1hgL6axDXQnoeo++ebfrvRSed+Fys4+6SvuSrPOv6PmWTBT/Wa
+GpO+tv48JUNxC/Dy8ROixBXOViuIBEFq3NfVH4HU3+RG20NhAkEA1L3RAhdfPkLI
+82luSOYE3Eq44lICb/yZi+JEihwSeZTJKdZHwYD8KVCjOtjGrOmyEyvThrcIACQz
+JLEreVh33wJBAMhJm9pzJJNkIyBgiXA66FAwbhdDzSTPx0OBjoVWoj6u7jzGvIFT
+Cn1aiTBYzzsiMCaCx+W3e6pK/DcvHSwKrgkCQHZMcxwBmSHLC2lnmD8LQWqqVnLr
+fZV+VnfVw501DQT0uoP8NvygWBg1Uf9YKepfLXnBpidEQjup5ZKivnUEv+sCQA8N
+6VcMHI2vkyxV1T7ITrnoSf4ZrIu9yl56mHnRPzSy9VlAHt8hnMI7UeB+bGUndrMO
+VXQgzHzKUhbbxbePvfECQQDTtkOuhJyKDfHCxLDcwNpi+T6OWTEfCw/cq9ZWDbA7
+yCX81pQxfZkfMIS1YFIOGHovK0rMMTraCe+iDNYtVz/L
+-----END RSA PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIIB9zCCAWACCQDjWWTeC6BQvTANBgkqhkiG9w0BAQQFADBAMQswCQYDVQQGEwJB
+VTETMBEGA1UECBMKU29tZS1TdGF0ZTEcMBoGA1UEChMTV2ViS2l0IExheW91dCBU
+ZXN0czAeFw0wNzA3MTMxMjUxMzJaFw03MTA1MTMwNjIzMTZaMEAxCzAJBgNVBAYT
+AkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMRwwGgYDVQQKExNXZWJLaXQgTGF5b3V0
+IFRlc3RzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmcXbusrr8zQr8snIb
+0OVQibVfgv7zPjh/5xdcrKOejJzp3epAAF4TITeFR9vzWIwkmkcRoY+IbQNhh7ke
+fGUYD47bvVamJMtq5cGYVs0HngT+KTMaNGH/G44KkFIOaz/b5d/JNKONrlqwxqXS
++m6IY4l/E1Ff25ZjND5TaEvI1wIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAAfbUbgD
+01O8DoZA02c1MUMbMHRPSb/qdok2pyWoCPa/BSaOIaNPePc8auPRbrS2XsVWSMft
+CTXiXmrK2Xx1+fJuZLAp0CUng4De4cDH5c8nvlocYmXo+1x53S9DfD0KPryjBRI7
+9LnJq2ysHAUawiqFXlwBag6mXawD8YjzcYat
+-----END CERTIFICATE-----
diff --git a/LayoutTests/http/tests/appcache/404-manifest-expected.txt b/LayoutTests/http/tests/appcache/404-manifest-expected.txt
new file mode 100644
index 0000000..b047077
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/404-manifest-expected.txt
@@ -0,0 +1,4 @@
+Test that subresources can be loaded if manifest is not available. Should say SUCCESS.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/404-manifest.html b/LayoutTests/http/tests/appcache/404-manifest.html
new file mode 100644
index 0000000..9b9bd30
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/404-manifest.html
@@ -0,0 +1,59 @@
+<html manifest="does-not-exist.manifest">
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function unexpectedEvent(name)
+{
+ log("FAILURE: Unexpected " + name + " event.");
+}
+
+applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noupdate") }, false);
+applicationCache.addEventListener('downloading', function() { unexpectedEvent("downloading") }, false);
+applicationCache.addEventListener('progress', function() { unexpectedEvent("progress") }, false);
+applicationCache.addEventListener('updateready', function() { unexpectedEvent("updateready") }, false);
+applicationCache.addEventListener('cached', function() { unexpectedEvent("cached") }, false);
+applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obsolete") }, false);
+
+function test()
+{
+ if (!gotCheckingEvent)
+ log("FAILURE: Did not get a checking event");
+ if (window.applicationCache.status)
+ log("FAILURE: Cache status is not UNCACHED, " + window.applicationCache.status);
+
+ // The manifest failed to load, so there should be no cache, and subresources should be loaded normally.
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "resources/simple.txt", false);
+ req.send();
+
+ if (req.responseText == 'Hello, World!')
+ log("SUCCESS");
+ else
+ log("FAILURE: Did not get expected response data.");
+ } catch (e) {
+ log("FAILURE: Could not load data.");
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var gotCheckingEvent = false;
+applicationCache.addEventListener('checking', function() { gotCheckingEvent = true; }, false);
+
+applicationCache.addEventListener('error', function() { test() }, false);
+
+</script>
+<p>Test that subresources can be loaded if manifest is not available. Should say SUCCESS.</p>
+
+<div id=result></div>
+</html>
diff --git a/LayoutTests/http/tests/appcache/404-resource-expected.txt b/LayoutTests/http/tests/appcache/404-resource-expected.txt
new file mode 100644
index 0000000..a8e5dea
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/404-resource-expected.txt
@@ -0,0 +1,6 @@
+Test that a missing explicit resource makes caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/404-resource.html b/LayoutTests/http/tests/appcache/404-resource.html
new file mode 100644
index 0000000..5439b8f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/404-resource.html
@@ -0,0 +1,39 @@
+<html manifest="resources/404-resource.manifest">
+<body>
+<p>Test that a missing explicit resource makes caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function unexpectedCallback(eventName)
+{
+ log("FAIL: An unexpected " + eventName + " event was dispatched on window.applicationCache.");
+}
+
+function test()
+{
+ if (applicationCache.status == applicationCache.UNCACHED)
+ log("SUCCESS");
+ else
+ log("FAILURE: cache status is not uncached: " + applicationCache.status);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { unexpectedCallback("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { unexpectedCallback("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/access-via-redirect-expected.txt b/LayoutTests/http/tests/appcache/access-via-redirect-expected.txt
new file mode 100644
index 0000000..8107c5f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/access-via-redirect-expected.txt
@@ -0,0 +1,3 @@
+This tests that the start of redirect chain doesn't get into an application cache if the end of the chain has a manifest.
+
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/access-via-redirect.php b/LayoutTests/http/tests/appcache/access-via-redirect.php
new file mode 100644
index 0000000..b0a61b0
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/access-via-redirect.php
@@ -0,0 +1,7 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: resources/access-via-redirect.html');
+?>
diff --git a/LayoutTests/http/tests/appcache/auth-expected.txt b/LayoutTests/http/tests/appcache/auth-expected.txt
new file mode 100644
index 0000000..7ec3f83
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/auth-expected.txt
@@ -0,0 +1,5 @@
+Test that appcache works with authentication. Should say SUCCESS:
+
+SUCCESS
+
+
diff --git a/LayoutTests/http/tests/appcache/auth.html b/LayoutTests/http/tests/appcache/auth.html
new file mode 100644
index 0000000..27b0ba6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/auth.html
@@ -0,0 +1,28 @@
+<body>
+<p>Test that appcache works with authentication. Should say SUCCESS:</p>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+// Store authentication credentials.
+var req = new XMLHttpRequest;
+req.open("GET", "resources/auth/setup.php", false, "login", "pasword");
+req.send();
+
+var ifr = document.createElement("iframe");
+ifr.setAttribute("src", "resources/auth/iframe.php");
+document.body.appendChild(ifr);
+
+function success()
+{
+ var text = document.createElement("p");
+ text.appendChild(document.createTextNode("SUCCESS"));
+ document.body.replaceChild(text, document.getElementsByTagName("iframe")[0]);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
+</body>
diff --git a/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back-expected.txt b/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back-expected.txt
new file mode 100644
index 0000000..0ad96dc
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back-expected.txt
@@ -0,0 +1,2 @@
+This tests that loading a page with a manifest, navigating away from the page, and then back does not cause a crash.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back.html b/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back.html
new file mode 100644
index 0000000..5b1fd9b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/crash-when-navigating-away-then-back.html
@@ -0,0 +1,27 @@
+<html>
+<script>
+function openWindow()
+{
+ window.open('resources/crash-when-navigating-away-then-back.html')
+}
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+ layoutTestController.setCanOpenWindows();
+} else {
+ document.write('<div id="manual-instructions">Click <a href="javascript:openWindow()">this link</a> twice. A window should open and close twice without crashing.</div>')
+}
+
+function closedWindow()
+{
+ if (window.layoutTestController)
+ setTimeout(openWindow, 100);
+}
+
+</script>
+<body onload="if (window.layoutTestController) openWindow()">
+<div>This tests that loading a page with a manifest, navigating away from the page, and then back does not cause a crash.</div>
+<div id="result">FAILURE - test not completed</div>
+</html>
+</div>
diff --git a/LayoutTests/http/tests/appcache/cyrillic-uri-expected.txt b/LayoutTests/http/tests/appcache/cyrillic-uri-expected.txt
new file mode 100644
index 0000000..3c3e640
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/cyrillic-uri-expected.txt
@@ -0,0 +1,13 @@
+Test that non-ASCII URIs work correctly in cache manifests.
+
+Should be a series of PASS messages, followed with DONE.
+
+PASS: resources/intercept/cached-Проверка
+PASS: resources/intercept/cached-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0
+PASS: resources/intercept/cached2-Проверка
+PASS: resources/intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0
+PASS: resources/intercept/network-Проверка-PASS
+PASS: resources/intercept/network-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-PASS
+PASS: resources/does-not-exist-Проверка
+DONE
+
diff --git a/LayoutTests/http/tests/appcache/cyrillic-uri.html b/LayoutTests/http/tests/appcache/cyrillic-uri.html
new file mode 100644
index 0000000..c86a261
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/cyrillic-uri.html
@@ -0,0 +1,82 @@
+<html manifest="resources/cyrillic-uri.manifest">
+<head>
+<meta charset="koi8-r">
+</head>
+<body>
+<p>Test that non-ASCII URIs work correctly in cache manifests.</p>
+<p>Should be a series of PASS messages, followed with DONE.</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function load(url)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", url, false);
+ req.send("");
+ return req.responseText;
+}
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", url, false);
+ req.send("");
+ return true;
+ } catch (ex) {
+ return false;
+ }
+}
+
+function shouldBeLoadable(url)
+{
+ log((canLoad(url) ? "PASS: " : "FAIL: ") + url);
+}
+
+function test()
+{
+ // Path is always UTF-8.
+ shouldBeLoadable("resources/intercept/cached-ðÒÏ×ÅÒËÁ");
+ shouldBeLoadable("resources/intercept/cached-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
+ shouldBeLoadable("resources/intercept/cached2-ðÒÏ×ÅÒËÁ");
+ shouldBeLoadable("resources/intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0");
+ shouldBeLoadable("resources/intercept/network-ðÒÏ×ÅÒËÁ-PASS");
+ shouldBeLoadable("resources/intercept/network-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0-PASS");
+ shouldBeLoadable("resources/does-not-exist-ðÒÏ×ÅÒËÁ");
+
+ // To test encodings other than UTF-8, we need to simulate form submission (for XHR, Firefox
+ // always uses UTF-8, even in query part).
+ applicationCache.onnoupdate = null;
+ applicationCache.oncached = null;
+ window.addEventListener("message", frameDone, false);
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/cyrillic-uri-form.html");
+ document.body.appendChild(ifr);
+}
+
+function frameDone(evt)
+{
+ log("DONE");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt
new file mode 100644
index 0000000..8e41eb6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-expected.txt
@@ -0,0 +1,4 @@
+Test the destruction of an iframe while deferred events are being raised does not crash the system.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html
new file mode 100644
index 0000000..902d3a8
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-delete-while-raising.html
@@ -0,0 +1,35 @@
+<html manifest="THIS_FILE_DOES_NOT_EXIST.manifest">
+<head>
+ <script src="THIS_FILE_DOES_NOT_EXIST.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ var isParentFrame = window == window.top;
+
+ if (isParentFrame) {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+ }
+
+ window.onmessage = function() {
+ document.getElementById('result').innerHTML = "SUCCESS";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ } else {
+ window.applicationCache.onchecking = function() {
+ parent.postMessage("hello", "*");
+ parent.killChildFrame();
+ }
+ }
+
+ function killChildFrame() {
+ document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+ }
+ </script>
+</head>
+<body>
+<p>Test the destruction of an iframe while deferred events are being raised does not crash the system.</p>
+<div id="result">FAILURE</div>
+<iframe src="deferred-events-delete-while-raising.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/deferred-events-expected.txt b/LayoutTests/http/tests/appcache/deferred-events-expected.txt
new file mode 100644
index 0000000..45af0af
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events-expected.txt
@@ -0,0 +1,2 @@
+Test that AppicationCache events are deferred until after onload has been fired.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/deferred-events.html b/LayoutTests/http/tests/appcache/deferred-events.html
new file mode 100644
index 0000000..ba9cf83
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/deferred-events.html
@@ -0,0 +1,24 @@
+<html manifest="THIS_FILE_DOES_NOT_EXIST.manifest">
+<head>
+ <script type="text/javascript">
+ var onloadHasBeenCalled = false;
+
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+ }
+
+ window.applicationCache.onchecking = function() {
+ if (onloadHasBeenCalled)
+ document.getElementById('result').innerHTML = "SUCCESS"
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ </script>
+ <script src="THIS_FILE_DOES_NOT_EXIST.js" type="text/javascript"></script>
+</head>
+<body onload="onloadHasBeenCalled = true">
+Test that AppicationCache events are deferred until after onload has been fired.
+<div id="result">FAILURE</div>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/destroyed-frame-expected.txt b/LayoutTests/http/tests/appcache/destroyed-frame-expected.txt
new file mode 100644
index 0000000..7050859
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/destroyed-frame-expected.txt
@@ -0,0 +1,5 @@
+Test for bug 33813: Crash when using DOMApplicationCache from a destroyed frame.
+
+PASS if didn't crash.
+
+
diff --git a/LayoutTests/http/tests/appcache/destroyed-frame.html b/LayoutTests/http/tests/appcache/destroyed-frame.html
new file mode 100644
index 0000000..c1dd731
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/destroyed-frame.html
@@ -0,0 +1,52 @@
+<body onload="test()">
+<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33813">bug 33813</a>: Crash when using DOMApplicationCache from a destroyed frame.</p>
+<p>PASS if didn't crash.</p>
+<iframe src="about:blank"></iframe>
+
+<script>
+
+function gc()
+{
+ if (window.GCController)
+ return GCController.collect();
+
+ for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
+ var s = new String("");
+ }
+}
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+var ifrCache;
+
+function test()
+{
+ ifrCache = frames[0].applicationCache;
+ document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+ setTimeout(function() {
+ gc();
+ ifrCache.onchecking = function() { }
+ ifrCache.onerror = function() { }
+ ifrCache.onnoupdate = function() { }
+ ifrCache.ondownloading = function() { }
+ ifrCache.onprogress = function() { }
+ ifrCache.onupdateready = function() { }
+ ifrCache.oncached = function() { }
+ ifrCache.onobsolete = function() { }
+ ifrCache.addEventListener("error", function() { }, true);
+
+ var evt = document.createEvent("Event");
+ evt.initEvent("error", true, true);
+ ifrCache.dispatchEvent(evt);
+
+ try { ifrCache.update(); } catch (ex) { }
+ try { ifrCache.swapCache(); } catch (ex) { }
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 0);
+}
+</script>
diff --git a/LayoutTests/http/tests/appcache/detached-iframe-expected.txt b/LayoutTests/http/tests/appcache/detached-iframe-expected.txt
new file mode 100644
index 0000000..1290b75
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/detached-iframe-expected.txt
@@ -0,0 +1,3 @@
+Test that accessing a detached iframe's applicationCache window property doesn't assert. If you don't see an assert, it passed.
+
+
diff --git a/LayoutTests/http/tests/appcache/detached-iframe.html b/LayoutTests/http/tests/appcache/detached-iframe.html
new file mode 100644
index 0000000..ce6aecf
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/detached-iframe.html
@@ -0,0 +1,15 @@
+<body onload = "test()">
+<p>Test that accessing a detached iframe's applicationCache window property doesn't assert. If you don't see an assert, it passed.</p>
+<iframe src="about:blank"></iframe>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function test()
+{
+ var ifr = frames[0];
+ document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+ ifr.applicationCache;
+}
+</script>
+</body>
diff --git a/LayoutTests/http/tests/appcache/different-origin-manifest-expected.txt b/LayoutTests/http/tests/appcache/different-origin-manifest-expected.txt
new file mode 100644
index 0000000..d08f58e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/different-origin-manifest-expected.txt
@@ -0,0 +1,3 @@
+Test that a different origin manifest is completely ignored.
+
+PASS
diff --git a/LayoutTests/http/tests/appcache/different-origin-manifest.html b/LayoutTests/http/tests/appcache/different-origin-manifest.html
new file mode 100644
index 0000000..b58c10a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/different-origin-manifest.html
@@ -0,0 +1,36 @@
+<html manifest="http://localhost:8000/appcache/resources/empty.manifest">
+<p>Test that a different origin manifest is completely ignored.</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+}
+
+var result = document.getElementById("result");
+var originalResult = result.innerHTML;
+
+try {
+ applicationCache.onchecking = function() { result.innerHTML += "FAIL: onchecking called. " }
+ applicationCache.onerror = function() { result.innerHTML += "FAIL: onerror called" }
+ applicationCache.onnoupdate = function() { result.innerHTML += "FAIL: onnoupdate called" }
+ applicationCache.ondownloading = function() { result.innerHTML += "FAIL: ondownloading called" }
+ applicationCache.onprogress = function() { result.innerHTML += "FAIL: onprogress called" }
+ applicationCache.onupdateready = function() { result.innerHTML += "FAIL: onupdateready called" }
+ applicationCache.oncached = function() { result.innerHTML += "FAIL: oncached called" }
+ applicationCache.onobsolete = function() { result.innerHTML += "FAIL: onobsolete called" }
+} catch (ex) {
+ result.innerHTML += "FAIL: " + ex;
+}
+function done()
+{
+ if (result.innerHTML == originalResult)
+ result.innerHTML = applicationCache.status == applicationCache.UNCACHED ? "PASS" : "FAIL: cache status in not UNCACHED";
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+setTimeout(done, 100);
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/different-scheme-expected.txt b/LayoutTests/http/tests/appcache/different-scheme-expected.txt
new file mode 100644
index 0000000..3c2462b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/different-scheme-expected.txt
@@ -0,0 +1,3 @@
+Test that application cache doesn't block loading resources with different schemes.
+
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/different-scheme.html b/LayoutTests/http/tests/appcache/different-scheme.html
new file mode 100644
index 0000000..c874097
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/different-scheme.html
@@ -0,0 +1,28 @@
+<html manifest="resources/different-scheme.manifest">
+<body>
+<p>Test that application cache doesn't block loading resources with different schemes.</p>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function test()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "javascript:parent.success(), 'PASS'");
+ document.body.appendChild(ifr);
+}
+
+function success()
+{
+ document.body.replaceChild(document.createTextNode("SUCCESS"), document.getElementsByTagName("iframe")[0]);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.oncached = test;
+applicationCache.onnoupdate = test;
+</script>
+<body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/disabled-expected.txt b/LayoutTests/http/tests/appcache/disabled-expected.txt
new file mode 100644
index 0000000..743bc6a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/disabled-expected.txt
@@ -0,0 +1,4 @@
+Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/disabled.html b/LayoutTests/http/tests/appcache/disabled.html
new file mode 100644
index 0000000..e89752a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/disabled.html
@@ -0,0 +1,51 @@
+<html>
+<body>
+<p>Test to ensure the the window.applicationCache attribute is defined but non-functional with the feature disabled.</p>
+<div id=result></div>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.overridePreference("WebKitOfflineWebApplicationCacheEnabled", false);
+ layoutTestController.dumpAsText();
+ }
+
+ function log(message)
+ {
+ document.getElementById("result").innerHTML += message + "<br>";
+ }
+
+ function isDefined() {
+ if (window.applicationCache)
+ return true;
+ else
+ return false;
+ }
+
+ function statusIsUncached() {
+ return applicationCache.status == 0;
+ }
+
+ function swapThrows() {
+ try {
+ applicationCache.swapCache();
+ return false;
+ } catch(e) {
+ return true;
+ }
+ }
+
+ function updateThrows() {
+ try {
+ applicationCache.swapCache();
+ return false;
+ } catch(e) {
+ return true;
+ }
+ }
+
+ if (isDefined() && statusIsUncached() && swapThrows() && updateThrows())
+ log("SUCCESS");
+ else
+ log("FAILURE");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/dynamic-entries-no-cache-expected.txt b/LayoutTests/http/tests/appcache/dynamic-entries-no-cache-expected.txt
new file mode 100644
index 0000000..6aad145
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/dynamic-entries-no-cache-expected.txt
@@ -0,0 +1,27 @@
+Test the behavior of DOMApplicationCache methods related to dynamic entries when the context is not associated with any cache.
+
+PASS: applicationCache.items.length is 0
+PASS: applicationCache.items.item(0) is null
+PASS: applicationCache.items.item(1) is null
+PASS: applicationCache.items.item(0xffffffff) is null
+PASS: applicationCache.items.item(0xfffffffe) is null
+PASS: applicationCache.items.item(-1) is null
+PASS: applicationCache.items.item(-2) is null
+PASS: applicationCache.items[0xfffffffe] is undefined
+PASS: applicationCache.items[0xffffffff] is undefined
+PASS: applicationCache.items['0'] is undefined
+PASS: applicationCache.items[''] is undefined
+PASS: applicationCache.items[0] is undefined
+PASS: applicationCache.items[1] is undefined
+PASS: applicationCache.items[-1] is undefined
+PASS: applicationCache.items[-2] is undefined
+PASS: applicationCache.items[100] is undefined
+PASS: applicationCache.items['100'] is undefined
+PASS: applicationCache.items['foo'] is undefined
+PASS: applicationCache.items[0.1] is undefined
+PASS: hasItem raised INVALID_STATE_ERR
+PASS: add raised INVALID_STATE_ERR
+PASS: remove raised INVALID_STATE_ERR
+PASS: applicationCache.items.length is 0
+DONE
+
diff --git a/LayoutTests/http/tests/appcache/dynamic-entries-no-cache.html-disabled b/LayoutTests/http/tests/appcache/dynamic-entries-no-cache.html-disabled
new file mode 100644
index 0000000..ed6e599
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/dynamic-entries-no-cache.html-disabled
@@ -0,0 +1,119 @@
+<body>
+<p>Test the behavior of DOMApplicationCache methods related to dynamic entries when the context
+is not associated with any cache.</p>
+<div id="result"></div>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+
+function isResultCorrect(_actual, _expected)
+{
+ if (_expected === 0)
+ return _actual === _expected && (1/_actual) === (1/_expected);
+ if (_actual === _expected)
+ return true;
+ if (typeof(_expected) == "number" && isNaN(_expected))
+ return typeof(_actual) == "number" && isNaN(_actual);
+ if (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([])) {
+ log("Array comparison is not supported");
+ return false;
+ }
+ return false;
+}
+
+function shouldBe(_a, _b)
+{
+ if (typeof _a != "string" || typeof _b != "string")
+ log("WARN: shouldBe() expects string arguments");
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+ var _bv = eval(_b);
+
+ if (exception)
+ log("FAIL: " + _a + " should be " + _bv + ". Threw exception " + exception);
+ else if (isResultCorrect(_av, _bv))
+ log("PASS: " + _a + " is " + _b);
+ else if (typeof(_av) == typeof(_bv))
+ log("FAIL: " + _a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+ else
+ log("FAIL: " + _a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+}
+
+
+shouldBe("applicationCache.items.length", "0");
+shouldBe("applicationCache.items.item(0)", "null");
+shouldBe("applicationCache.items.item(1)", "null");
+shouldBe("applicationCache.items.item(0xffffffff)", "null");
+shouldBe("applicationCache.items.item(0xfffffffe)", "null");
+shouldBe("applicationCache.items.item(-1)", "null");
+shouldBe("applicationCache.items.item(-2)", "null");
+
+shouldBe("applicationCache.items[0xfffffffe]", "undefined");
+shouldBe("applicationCache.items[0xffffffff]", "undefined");
+
+// The below index access tests give different results in WebKit and Firefox 3.1b2 (undefined vs. empty string).
+shouldBe("applicationCache.items['0']", "undefined");
+shouldBe("applicationCache.items['']", "undefined");
+shouldBe("applicationCache.items[0]", "undefined");
+shouldBe("applicationCache.items[1]", "undefined");
+shouldBe("applicationCache.items[-1]", "undefined");
+shouldBe("applicationCache.items[-2]", "undefined");
+applicationCache.items[100] = "foobar";
+applicationCache.items['100'] = "foobar";
+applicationCache.items['foo'] = "bar";
+shouldBe("applicationCache.items[100]", "undefined");
+shouldBe("applicationCache.items['100']", "undefined");
+
+shouldBe("applicationCache.items['foo']", "undefined");
+shouldBe("applicationCache.items[0.1]", "undefined");
+
+try {
+ applicationCache.hasItem('foo');
+ log("FAIL: hasItem didn't raise an exception");
+} catch (ex) {
+ if (ex.code == 11)
+ log("PASS: hasItem raised INVALID_STATE_ERR");
+ else
+ log("FAIL: hasItem raised unexpected exception " + ex);
+}
+
+try {
+ applicationCache.add('foo');
+ log("FAIL: add didn't raise an exception");
+} catch (ex) {
+ if (ex.code == 11)
+ log("PASS: add raised INVALID_STATE_ERR");
+ else
+ log("FAIL: add raised unexpected exception " + ex);
+}
+
+try {
+ applicationCache.remove('bar');
+ log("FAIL: remove didn't raise an exception");
+} catch (ex) {
+ if (ex.code == 11)
+ log("PASS: remove raised INVALID_STATE_ERR");
+ else
+ log("FAIL: remove raised unexpected exception " + ex);
+}
+
+shouldBe("applicationCache.items.length", "0");
+
+
+
+log("DONE");
+
+</script>
+</head>
+</body>
diff --git a/LayoutTests/http/tests/appcache/empty-manifest-expected.txt b/LayoutTests/http/tests/appcache/empty-manifest-expected.txt
new file mode 100644
index 0000000..bba93cf
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/empty-manifest-expected.txt
@@ -0,0 +1,2 @@
+This tests that the cached event gets sent even if the manifest is empty.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/empty-manifest.html b/LayoutTests/http/tests/appcache/empty-manifest.html
new file mode 100644
index 0000000..67752e6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/empty-manifest.html
@@ -0,0 +1,23 @@
+<html manifest="resources/empty.manifest">
+
+<div>This tests that the cached event gets sent even if the manifest is empty.</div>
+<div id="result">FAILURE</div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function cached()
+{
+ document.getElementById('result').innerHTML = 'SUCCESS';
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/fail-on-update-expected.txt b/LayoutTests/http/tests/appcache/fail-on-update-expected.txt
new file mode 100644
index 0000000..cd15247
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/fail-on-update-expected.txt
@@ -0,0 +1 @@
+SUCCESS: No crash.
diff --git a/LayoutTests/http/tests/appcache/fail-on-update.html b/LayoutTests/http/tests/appcache/fail-on-update.html
new file mode 100644
index 0000000..b021fcc
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/fail-on-update.html
@@ -0,0 +1,47 @@
+<html manifest="resources/fail-on-update.php">
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function setManifestDeleted(state)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false);
+ req.send(null);
+}
+
+function test()
+{
+ clearTimeout(timeoutId);
+
+ setManifestDeleted(true);
+ applicationCache.update();
+ window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' +
+ '<script>' +
+ 'if (window.layoutTestController) layoutTestController.notifyDone();' +
+ '</scri' + 'pt>';
+}
+
+function resetManifest()
+{
+ if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) {
+ timeoutId = setTimeout(resetManifest, 100);
+ return;
+ }
+
+ setManifestDeleted(false);
+ location.reload();
+}
+
+applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }, false);
+applicationCache.addEventListener('cached', function() { setTimeout(test, 0) }, false);
+
+// If the manifest script happened to be in a wrong state, reset it.
+var timeoutId = setTimeout(resetManifest, 100);
+
+</script>
+<p>Test for a particular incorrect assertion failure.</p>
+
+</html>
diff --git a/LayoutTests/http/tests/appcache/fallback-expected.txt b/LayoutTests/http/tests/appcache/fallback-expected.txt
new file mode 100644
index 0000000..6dc0f5a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/fallback-expected.txt
@@ -0,0 +1,6 @@
+Test application cache fallback entries.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/fallback.html b/LayoutTests/http/tests/appcache/fallback.html
new file mode 100644
index 0000000..aaf7a82
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/fallback.html
@@ -0,0 +1,171 @@
+<html manifest="resources/fallback.manifest">
+<body>
+<p>Test application cache fallback entries.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+var hadError = false;
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function setNetworkEnabled(state)
+{
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+ req.send("");
+ } catch (ex) {
+ log("Cannot access network simulator URL");
+ hadError = true;
+ }
+}
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send("");
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function load(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send("");
+ return req.responseText;
+ } catch (ex) {
+ alert("Unexpected error loading " + url + ": " + ex);
+ hadError = true;
+ }
+}
+
+var testURL = "/resources/network-simulator.php?path=/appcache/resources/not-in-cache.txt";
+var nonexistentURL = "resources/does-not-exist";
+var redirectURL = "resources/fallback-redirect.php";
+
+function test()
+{
+ applicationCache.onnoupdate = function() { log("FAIL: received unexpected noupdate event") }
+ applicationCache.oncached = function() { log("FAIL: received unexpected cached event") }
+
+ setNetworkEnabled(true);
+
+ if (!canLoad(testURL) || !/not in the cache/.test(load(testURL))) {
+ log("FAIL: Cannot load an URL from fallback namespace when network is enabled");
+ hadError = true;
+ }
+
+ if (!canLoad(nonexistentURL) || load(nonexistentURL) != "Hello, World!") {
+ log("FAIL: Fallback resource wasn't used for a 404 response");
+ hadError = true;
+ }
+
+ if (!canLoad(redirectURL) || load(redirectURL) != "Hello, World!") {
+ log("FAIL: Fallback resource wasn't used for a redirect to a resource with another origin");
+ hadError = true;
+ }
+
+ test2();
+}
+
+function test2()
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", nonexistentURL);
+ req.onerror = function() {
+ log("FAIL: Fallback resource wasn't used for a 404 response (async)");
+ hadError = true;
+ test3();
+ }
+ req.onload = function() {
+ if (req.responseText != "Hello, World!") {
+ log("FAIL: Unexpected result for a 404 response (async)");
+ hadError = true;
+ }
+ test3();
+ }
+
+ req.send("");
+}
+
+function test3()
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", redirectURL);
+ req.onerror = function() {
+ log("FAIL: Fallback resource wasn't used for a redirect to a resource with another origin (async)");
+ hadError = true;
+ test4();
+ }
+ req.onload = function() {
+ if (req.responseText != "Hello, World!") {
+ log("FAIL: Unexpected result for a redirect response (async)");
+ hadError = true;
+ }
+ test4();
+ }
+
+ req.send("");
+}
+
+function test4()
+{
+ // Try loading a fallback resource as main one.
+
+ applicationCache.onnoupdate = test5;
+
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", nonexistentURL);
+ document.body.appendChild(ifr);
+}
+
+function test5()
+{
+ if (!/Hello, World/.test(window.frames[0].document.documentElement.innerHTML)) {
+ log("FAIL: Fallback URL was not honored for main resource");
+ hadError = true;
+ }
+ test6();
+}
+
+function test6()
+{
+ setNetworkEnabled(false);
+
+ if (!canLoad(testURL)) {
+ log("FAIL: Cannot load an URL from fallback namespace when network is disabled");
+ hadError = true;
+ } else if (load(testURL) != load("resources/simple.txt")) {
+ log("FAIL: Loading an URL from fallback namespace when network is disabled returned unexpected response");
+ hadError = true;
+ }
+
+ log(hadError ? "FAILURE" : "SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt b/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt
new file mode 100644
index 0000000..64d4de2
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt
@@ -0,0 +1,10 @@
+Test for <rdar://problem/6284708> AppCache crashes in ApplicationCacheResource::addType().
+
+checking
+downloading
+progress
+progress
+progress
+cached
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/foreign-iframe-main.html b/LayoutTests/http/tests/appcache/foreign-iframe-main.html
new file mode 100644
index 0000000..a543eef
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/foreign-iframe-main.html
@@ -0,0 +1,39 @@
+<html manifest="resources/foreign-iframe.manifest"> <!-- Any manifest would do the trick. -->
+<body>
+<p>Test for <a href="rdar://problem/6284708">&lt;rdar://problem/6284708></a> AppCache crashes in ApplicationCacheResource::addType().</p>
+
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "http://localhost:8000/appcache/resources/foreign-iframe.html");
+ document.body.appendChild(ifr);
+}
+
+applicationCache.addEventListener('checking', function() { log("checking") }, false);
+applicationCache.addEventListener('error', function() { log("error") }, false);
+applicationCache.addEventListener('downloading', function() { log("downloading") }, false);
+applicationCache.addEventListener('progress', function() { log("progress") }, false);
+applicationCache.addEventListener('updateready', function() { log("updateready") }, false);
+applicationCache.addEventListener('obsolete', function() { log("obsolete") }, false);
+
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); test() }, false);
+applicationCache.addEventListener('cached', function() { log("cached"); test() }, false);
+
+window.addEventListener("message", function() { log("SUCCESS"); if (window.layoutTestController) layoutTestController.notifyDone() }, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/idempotent-update-expected.txt b/LayoutTests/http/tests/appcache/idempotent-update-expected.txt
new file mode 100644
index 0000000..6fa942a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/idempotent-update-expected.txt
@@ -0,0 +1,6 @@
+Test what applicationCache.update() does if update is already in progess.
+
+Should say DONE, with no failures:
+
+DONE
+
diff --git a/LayoutTests/http/tests/appcache/idempotent-update.html b/LayoutTests/http/tests/appcache/idempotent-update.html
new file mode 100644
index 0000000..652369d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/idempotent-update.html
@@ -0,0 +1,56 @@
+<html manifest="resources/idempotent-update.manifest">
+<body>
+<p>Test what applicationCache.update() does if update is already in progess.</p>
+<p>Should say DONE, with no failures:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ // During update, additional update() should be no-op (the spec says that fake checking and
+ // downloading events need to be dispatched, but that's only when the update algorithm is invoked
+ // with a browsing context).
+ if (applicationCache.status != applicationCache.IDLE)
+ log("FAIL: Unexpected cache status while preparing to test: " + applicationCache.status);
+
+ var checkingCount = 0;
+ applicationCache.onchecking = function() { if (++checkingCount != 1) log("FAIL: Too many checking events received.") }
+
+ applicationCache.update();
+ applicationCache.update();
+ applicationCache.update();
+ applicationCache.update();
+ applicationCache.update();
+
+ applicationCache.onnoupdate = done;
+ applicationCache.oncached = function() { log("FAIL: received unexpected cached event") }
+}
+
+function done()
+{
+ setTimeout(function() {
+ log("DONE");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 10);
+}
+
+applicationCache.oncached = test;
+applicationCache.onnoupdate = test;
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/local-content-expected.txt b/LayoutTests/http/tests/appcache/local-content-expected.txt
new file mode 100644
index 0000000..5c1aa37
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/local-content-expected.txt
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: line 0: Not allowed to load local resource: stdio.h
+Test that documents loaded from application cache don't get access to local resources accidentally.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/local-content.html b/LayoutTests/http/tests/appcache/local-content.html
new file mode 100644
index 0000000..0787567
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/local-content.html
@@ -0,0 +1,51 @@
+<html manifest="resources/local-content.manifest">
+<body>
+<p>Test that documents loaded from application cache don't get access to local resources accidentally.</p>
+<p>Should say SUCCESS:</p>
+<div id="result"></div>
+<script type="text/javascript">
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function noupdate()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "file:///usr/include/stdio.h");
+ ifr.onload = frameCreated;
+ setTimeout(function() {
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 300);
+
+ document.body.appendChild(ifr);
+}
+
+function frameCreated()
+{
+ log("FAILURE: A local resource was opened in an iframe");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function reload()
+{
+ // Reload to ensure that the main document was loaded from application cache.
+ window.location.reload();
+}
+
+applicationCache.addEventListener('noupdate', noupdate, false);
+
+applicationCache.addEventListener('cached', reload, false);
+applicationCache.addEventListener('error', function() { alert("Unexpected error event") }, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/main-resource-hash-expected.txt b/LayoutTests/http/tests/appcache/main-resource-hash-expected.txt
new file mode 100644
index 0000000..50f4f71
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/main-resource-hash-expected.txt
@@ -0,0 +1,6 @@
+Test that offline applications' main resources are not affected by URL hashes.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/main-resource-hash.html b/LayoutTests/http/tests/appcache/main-resource-hash.html
new file mode 100644
index 0000000..6dbce36
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/main-resource-hash.html
@@ -0,0 +1,51 @@
+<html>
+<body>
+<p>Test that offline applications' main resources are not affected by URL hashes.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function setNetworkEnabled(state)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+ req.send("");
+}
+
+function frameCreated()
+{
+ if (stage == 0) {
+ stage = 1;
+ setNetworkEnabled(false);
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/main-resource-hash-frame.html#bar");
+ document.body.appendChild(ifr);
+ } else {
+ log("SUCCESS");
+ setNetworkEnabled(true);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+ }
+}
+
+window.addEventListener("message", frameCreated, false);
+
+var stage = 0;
+setNetworkEnabled(true);
+var ifr = document.createElement("iframe");
+ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/main-resource-hash-frame.html#foo");
+document.body.appendChild(ifr);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/manifest-containing-itself-expected.txt b/LayoutTests/http/tests/appcache/manifest-containing-itself-expected.txt
new file mode 100644
index 0000000..77e2506
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-containing-itself-expected.txt
@@ -0,0 +1,2 @@
+This tests that a manifest can contain itself as a resource.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/manifest-containing-itself.html b/LayoutTests/http/tests/appcache/manifest-containing-itself.html
new file mode 100644
index 0000000..89a5410
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-containing-itself.html
@@ -0,0 +1,24 @@
+<html manifest="resources/manifest-containing-itself.manifest">
+
+<div>This tests that a manifest can contain itself as a resource.</div>
+<div id="result">FAILURE</div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function cached()
+{
+ document.getElementById('result').innerHTML = 'SUCCESS';
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+applicationCache.addEventListener('noupdate', cached, false);
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/manifest-parsing-expected.txt b/LayoutTests/http/tests/appcache/manifest-parsing-expected.txt
new file mode 100644
index 0000000..fc15310
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-parsing-expected.txt
@@ -0,0 +1,4 @@
+Test application cache manifest parsing.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/manifest-parsing.html b/LayoutTests/http/tests/appcache/manifest-parsing.html
new file mode 100644
index 0000000..46a7fdd
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-parsing.html
@@ -0,0 +1,66 @@
+<html manifest="resources/manifest-parsing.manifest">
+<body>
+<p>Test application cache manifest parsing.</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send();
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function test()
+{
+ var hadError = false;
+
+ // Check that section name wasn't misparsed as resource URL.
+ if (canLoad("resources/UNKNOWN:")) {
+ log("Loaded 'UNKNOWN:'");
+ hadError = true;
+ }
+
+ // Load a resource that was in UNKNOWN section - in other words, that is not in cache.
+ if (canLoad("resources/not-in-cache.txt")) {
+ log("Loaded 'not-in-cache.txt'");
+ hadError = true;
+ }
+
+ // Load resources were specified with tricky whitespace.
+ if (!canLoad("resources/empty.txt")) {
+ log("Could not load 'empty.txt'");
+ hadError = true;
+ }
+ if (!canLoad("resources/simple.txt")) {
+ log("Could not load 'simple.txt'");
+ hadError = true;
+ }
+
+ log(hadError ? "FAILURE" : "SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onerror = function() { log("error") }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/manifest-redirect-2-expected.txt b/LayoutTests/http/tests/appcache/manifest-redirect-2-expected.txt
new file mode 100644
index 0000000..420e94b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-redirect-2-expected.txt
@@ -0,0 +1,6 @@
+Test that a redirect makes resource caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/manifest-redirect-2.html b/LayoutTests/http/tests/appcache/manifest-redirect-2.html
new file mode 100644
index 0000000..7c00d41
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-redirect-2.html
@@ -0,0 +1,40 @@
+<html manifest="resources/manifest-redirect-2.php">
+<body>
+<p>Test that a redirect makes resource caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated wuth any cache yet.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/manifest-redirect-expected.txt b/LayoutTests/http/tests/appcache/manifest-redirect-expected.txt
new file mode 100644
index 0000000..420e94b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-redirect-expected.txt
@@ -0,0 +1,6 @@
+Test that a redirect makes resource caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/manifest-redirect.html b/LayoutTests/http/tests/appcache/manifest-redirect.html
new file mode 100644
index 0000000..3f75547
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-redirect.html
@@ -0,0 +1,40 @@
+<html manifest="resources/manifest-redirect.php">
+<body>
+<p>Test that a redirect makes resource caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated wuth any cache yet.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/manifest-with-empty-file-expected.txt b/LayoutTests/http/tests/appcache/manifest-with-empty-file-expected.txt
new file mode 100644
index 0000000..3cf2ce6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-with-empty-file-expected.txt
@@ -0,0 +1,2 @@
+This tests that a manifest that contains an empty file will not crash the browser.
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/manifest-with-empty-file.html b/LayoutTests/http/tests/appcache/manifest-with-empty-file.html
new file mode 100644
index 0000000..b9ae051
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-with-empty-file.html
@@ -0,0 +1,21 @@
+<html manifest="resources/manifest-with-empty-file.manifest">
+<div>This tests that a manifest that contains an empty file will not crash the browser.</div>
+<div id="result">FAILURE</div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function cached()
+{
+ document.getElementById('result').innerHTML = 'SUCCESS';
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+
+</script>
+
+</html>
diff --git a/LayoutTests/http/tests/appcache/max-size-expected.txt b/LayoutTests/http/tests/appcache/max-size-expected.txt
new file mode 100644
index 0000000..b915156
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/max-size-expected.txt
@@ -0,0 +1,4 @@
+Cache a manifest that contains a resource that is too large to fit. The layout test controller sets a maximum size of 10KB for the application cache database file.
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/max-size.html b/LayoutTests/http/tests/appcache/max-size.html
new file mode 100644
index 0000000..8f4e855
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/max-size.html
@@ -0,0 +1,28 @@
+<html manifest="resources/maxsize.manifest">
+<body>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.setAppCacheMaximumSize(10 * 1024);
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ function log(message)
+ {
+ document.getElementById("result").innerHTML += message + "<br>";
+ if (window.layoutTestController) {
+ layoutTestController.setAppCacheMaximumSize(100 * 1024 * 1024);
+ layoutTestController.notifyDone();
+ }
+ }
+
+ applicationCache.onerror = function() { log("SUCCESS"); }
+ applicationCache.oncached = function() { log("FAIL: received unexpected cached event"); }
+ applicationCache.onnoupdate = function() { log("FAIL: received unexpected onnoupdate event"); }
+ applicationCache.onupdateready = function() { log("FAIL: received unexpected onupdateready event"); }
+</script>
+
+<p>Cache a manifest that contains a resource that is too large to fit. The layout test controller sets a maximum size of 10KB for the application cache database file.</p>
+<div id=result></div>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress-expected.txt b/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress-expected.txt
new file mode 100644
index 0000000..ca09f7e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress-expected.txt
@@ -0,0 +1,2 @@
+This tests that navigating away while a cache is loading does not crash.
+SUCCESS - did not crash
diff --git a/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress.html b/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress.html
new file mode 100644
index 0000000..7e7920a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/navigating-away-while-cache-attempt-in-progress.html
@@ -0,0 +1,21 @@
+<html manifest="resources/navigating-away-while-cache-attempt-in-progress.manifest">
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function navigateAway() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ else
+ window.location.href = "about:blank"
+}
+
+setTimeout(navigateAway, 1000);
+
+</script>
+<div>This tests that navigating away while a cache is loading does not crash.</div>
+<div>SUCCESS - did not crash</div>
+</html>
diff --git a/LayoutTests/http/tests/appcache/non-html-expected.txt b/LayoutTests/http/tests/appcache/non-html-expected.txt
new file mode 100644
index 0000000..7c0e8c4
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/non-html-expected.txt
@@ -0,0 +1,6 @@
+Test that non-HTML main resources work with application cache correctly.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/non-html.xhtml b/LayoutTests/http/tests/appcache/non-html.xhtml
new file mode 100644
index 0000000..d27681e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/non-html.xhtml
@@ -0,0 +1,103 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ manifest="/resources/network-simulator.php?path=/appcache/resources/non-html.manifest">
+<head><title/></head>
+<body>
+<p>Test that non-HTML main resources work with application cache correctly.</p>
+<p>Should say SUCCESS:</p>
+<div id="result"></div>
+<script type="text/javascript">
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "&lt;br/>";
+}
+
+function setNetworkEnabled(state)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+ req.send("");
+}
+
+function createFrame()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/abe.png");
+ ifr.onload = frameCreated;
+ document.body.appendChild(ifr);
+}
+
+function cached()
+{
+ var hadError = false;
+
+ applicationCache.removeEventListener('noupdate', cached, false);
+ applicationCache.removeEventListener('cached', cached, false);
+
+ setNetworkEnabled(false);
+
+ // Load a resource that does not exist in the cache.
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "/resources/network-simulator.php?path=/appcache/resources/not-in-cache.txt", false);
+ req.send();
+ } catch (e) {
+ if (e.code == XMLHttpRequestException.NETWORK_ERR)
+ hadError = true;
+ }
+
+ if (!hadError) {
+ document.getElementById('result').innerHTML = "FAILURE: Did not get the right exception"
+ return;
+ }
+
+ // Load a resource that exists in the cache.
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "/resources/network-simulator.php?path=/appcache/resources/simple.txt", false);
+ req.send();
+ } catch (e) {
+ document.getElementById('result').innerHTML = "FAILURE: Could not load data from cache"
+ return;
+ }
+
+ if (req.responseText != 'Hello, World!') {
+ document.getElementById('result').innerHTML = "FAILURE: Did not get correct data from cached resource"
+ return;
+ }
+
+ createFrame();
+}
+
+function frameCreated()
+{
+ setNetworkEnabled(true);
+
+ if (frames[0].document.documentElement.innerHTML.match(/abe\.png/))
+ log("SUCCESS")
+ else
+ log("FAIL: Frame.onload was called, but the image doesn't seem to be loaded.");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function error()
+{
+ // The simulator was in a wrong state, reset it.
+ setNetworkEnabled(true);
+ window.location.reload();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+applicationCache.addEventListener('noupdate', cached, false);
+
+applicationCache.addEventListener('error', error, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/offline-access-expected.txt b/LayoutTests/http/tests/appcache/offline-access-expected.txt
new file mode 100644
index 0000000..0fcc923
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/offline-access-expected.txt
@@ -0,0 +1,6 @@
+Test that offline applications work when there is no network access (simulated).
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/offline-access.html b/LayoutTests/http/tests/appcache/offline-access.html
new file mode 100644
index 0000000..45e9d4e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/offline-access.html
@@ -0,0 +1,57 @@
+<html>
+<body>
+<p>Test that offline applications work when there is no network access (simulated).</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function setNetworkEnabled(state)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+ req.send("");
+}
+
+function createFrame()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/offline-access-frame.html");
+ document.body.appendChild(ifr);
+}
+
+function frameCreated()
+{
+ if (stage == 0) {
+ stage = 1;
+ setNetworkEnabled(false);
+ createFrame();
+ } else if (stage == 1) {
+ stage = 2;
+ setNetworkEnabled(true);
+ createFrame();
+ } else {
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+ }
+}
+
+window.addEventListener("message", frameCreated, false);
+
+var stage = 0;
+setNetworkEnabled(true);
+createFrame();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/online-whitelist-expected.txt b/LayoutTests/http/tests/appcache/online-whitelist-expected.txt
new file mode 100644
index 0000000..a605108
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/online-whitelist-expected.txt
@@ -0,0 +1,4 @@
+Test online whitelist functionality. Should say PASS:
+
+PASS
+
diff --git a/LayoutTests/http/tests/appcache/online-whitelist.html b/LayoutTests/http/tests/appcache/online-whitelist.html
new file mode 100644
index 0000000..f33fb6d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/online-whitelist.html
@@ -0,0 +1,77 @@
+<html manifest="resources/online-whitelist.manifest">
+<body>
+<p>Test online whitelist functionality. Should say PASS:</p>
+
+<div id="result"></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+var hadError = false;
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send("");
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function load(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send("");
+ return req.responseText;
+ } catch (ex) {
+ alert("Unexpected error loading " + url + ": " + ex);
+ hadError = true;
+ }
+}
+
+function test()
+{
+ if (load("resources/counter.php?cached") != load("resources/counter.php?cached")) {
+ log("FAIL: Explicit entry didn't override online whitelist.");
+ hadError = true;
+ }
+
+ if (load("resources/counter.php?uncached") == load("resources/counter.php?uncached")) {
+ log("FAIL: Online whitelist resource wasn't reloaded from network.");
+ hadError = true;
+ }
+
+ if (load("resources/counter.php?uncachedxxx") == load("resources/counter.php?uncachedxxx")) {
+ log("FAIL: Online whitelist resource wasn't reloaded from network (prefix matching).");
+ hadError = true;
+ }
+
+ if (canLoad("resources/counter.php?foobar")) {
+ log("FAIL: Uncached resource was successfully loaded.");
+ hadError = true;
+ }
+
+ log(hadError ? "FAIL" : "PASS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', test, false);
+applicationCache.addEventListener('noupdate', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/reload-expected.txt b/LayoutTests/http/tests/appcache/reload-expected.txt
new file mode 100644
index 0000000..7bfc07b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/reload-expected.txt
@@ -0,0 +1,8 @@
+Test that the manifest is picked correctly when reloading.
+
+Should say SUCCESS:
+
+Frame loaded
+Frame loaded
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/reload.html b/LayoutTests/http/tests/appcache/reload.html
new file mode 100644
index 0000000..6e2da56
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/reload.html
@@ -0,0 +1,40 @@
+<html>
+<body>
+<p>Test that the manifest is picked correctly when reloading.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+var state = 0;
+function receivedMessage(message)
+{
+ log(message);
+
+ if (state == 0) {
+ state = 1;
+ setTimeout("frames[0].location.reload()", 0);
+ } else if (state == 1) {
+ state = 2;
+ setTimeout("frames[0].test()", 0);
+ } else if (state == 2) {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+}
+
+window.addEventListener("message", function(e) { receivedMessage(e.data) }, false);
+
+</script>
+<iframe src="resources/reload-iframe.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/remove-cache-expected.txt b/LayoutTests/http/tests/appcache/remove-cache-expected.txt
new file mode 100644
index 0000000..9e23ba1
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/remove-cache-expected.txt
@@ -0,0 +1,10 @@
+Test that a 404 response for manifest results in cache removal.
+
+Frame 1: Manifest is still available, so a new master resource is added to the cache.
+Frame 2: Manifest loading results in 404 response, so the cache group becomes obsolete, and an obsolete event is dispatched (because the document in frame was associated with a cache in the group).
+Frame 3: Manifest is still 404 - the document is never associated with a cache.
+Frame 4: Manifest is now available, so the document gets associated with a cache in a newly created group; the obsolete cache group is not affected.
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/remove-cache.html b/LayoutTests/http/tests/appcache/remove-cache.html
new file mode 100644
index 0000000..954418c
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/remove-cache.html
@@ -0,0 +1,111 @@
+<html manifest="resources/fail-on-update.php">
+<p>Test that a 404 response for manifest results in cache removal.</p>
+<body>
+<ul>
+<li>Frame 1: Manifest is still available, so a new master resource is added to the cache.
+<li>Frame 2: Manifest loading results in 404 response, so the cache group becomes obsolete, and an obsolete event is dispatched (because the document in frame was associated with a cache in the group).
+<li>Frame 3: Manifest is still 404 - the document is never associated with a cache.
+<li>Frame 4: Manifest is now available, so the document gets associated with a cache in a newly created group; the obsolete cache group is not affected.
+</ul>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function setManifestDeleted(state)
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false);
+ req.send(null);
+}
+
+function test()
+{
+ clearTimeout(timeoutId);
+
+ // The frame will be associated to a cache, and its main resource will be added to the cache.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/remove-cache-frame.html");
+ document.body.appendChild(ifr);
+ applicationCache.onnoupdate = test2;
+}
+
+function test2()
+{
+ applicationCache.onnoupdate = function() { log("Unexpected noupdate event") }
+ applicationCache.oncached = function() { log("Unexpected cached event") }
+
+ setManifestDeleted(true);
+ // The frame will be associated to a cache, but update will obsolete it.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/remove-cache-frame.html");
+ document.body.appendChild(ifr);
+ applicationCache.onobsolete = test3;
+}
+
+function test3()
+{
+ applicationCache.onchecking = function() { log("Unexpected checking event after obsolete event") }
+ applicationCache.onupdateready = function() { log("Unexpected updateready event after obsolete event") }
+ applicationCache.onerror = function() { log("Unexpected error event after obsolete event") }
+ applicationCache.onnoupdate = function() { log("Unexpected noupdate event after obsolete event") }
+ applicationCache.oncached = function() { log("Unexpected cached event after obsolete event") }
+
+ // The frame will not be associated to a cache.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/remove-cache-frame.html");
+ document.body.appendChild(ifr);
+ window.addEventListener("message", test4, false);
+}
+
+function test4()
+{
+ setManifestDeleted(false);
+
+ window.removeEventListener("message", test4, false);
+ applicationCache.onupdateready = null;
+
+ // The frame will be associated to a cache.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/remove-cache-frame-2.html");
+ document.body.appendChild(ifr);
+ window.addEventListener("message", test5, false);
+}
+
+function test5()
+{
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function resetManifest()
+{
+ if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) {
+ timeoutId = setTimeout(resetManifest, 100);
+ return;
+ }
+
+ setManifestDeleted(false);
+ location.reload();
+}
+
+applicationCache.onupdateready = function() { log("Unexpected updateready event") }
+applicationCache.onnoupdate = test;
+applicationCache.oncached = test;
+
+// If the manifest script happened to be in a wrong state, reset it.
+var timeoutId = setTimeout(resetManifest, 100);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resource-redirect-2-expected.txt b/LayoutTests/http/tests/appcache/resource-redirect-2-expected.txt
new file mode 100644
index 0000000..420e94b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resource-redirect-2-expected.txt
@@ -0,0 +1,6 @@
+Test that a redirect makes resource caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/resource-redirect-2.html b/LayoutTests/http/tests/appcache/resource-redirect-2.html
new file mode 100644
index 0000000..cf0d3a8
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resource-redirect-2.html
@@ -0,0 +1,40 @@
+<html manifest="resources/resource-redirect-2.manifest">
+<body>
+<p>Test that a redirect makes resource caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An unexpected event was dispatched on window.applicationCache.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resource-redirect-expected.txt b/LayoutTests/http/tests/appcache/resource-redirect-expected.txt
new file mode 100644
index 0000000..420e94b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resource-redirect-expected.txt
@@ -0,0 +1,6 @@
+Test that a redirect makes resource caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/resource-redirect.html b/LayoutTests/http/tests/appcache/resource-redirect.html
new file mode 100644
index 0000000..7fdf5f8
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resource-redirect.html
@@ -0,0 +1,40 @@
+<html manifest="resources/resource-redirect.manifest">
+<body>
+<p>Test that a redirect makes resource caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An unexpected event was dispatched on window.applicationCache.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/.htaccess b/LayoutTests/http/tests/appcache/resources/.htaccess
new file mode 100644
index 0000000..dfa433b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/.htaccess
@@ -0,0 +1,5 @@
+RewriteEngine on
+RewriteRule ^UNKNOWN_SECTION: simple.txt [L,NS]
+<Files wrong-content-type.manifest>
+ForceType text/plain
+</Files>
diff --git a/LayoutTests/http/tests/appcache/resources/404-resource.manifest b/LayoutTests/http/tests/appcache/resources/404-resource.manifest
new file mode 100644
index 0000000..b2c066d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/404-resource.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+does-not-exist.txt
diff --git a/LayoutTests/http/tests/appcache/resources/abe.png b/LayoutTests/http/tests/appcache/resources/abe.png
new file mode 100644
index 0000000..c932536
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/abe.png
Binary files differ
diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.html b/LayoutTests/http/tests/appcache/resources/access-via-redirect.html
new file mode 100644
index 0000000..510f841
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/access-via-redirect.html
@@ -0,0 +1,46 @@
+<html manifest="access-via-redirect.manifest">
+
+<p>This tests that the start of redirect chain doesn't get into an application cache if the end of the chain has a manifest.</p>
+<p id="result">FAILURE</p>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send("");
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function cached()
+{
+ if (canLoad("/appcache/access-via-redirect.php")) {
+ document.getElementById('result').innerHTML = "FAILURE: Start of redirect chain is in cache."
+ return;
+ }
+
+ if (!canLoad("access-via-redirect.html")) {
+ document.getElementById('result').innerHTML = "FAILURE: Could not load main resource from cache."
+ return;
+ }
+
+ document.getElementById('result').innerHTML = "SUCCESS"
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+applicationCache.addEventListener('noupdate', cached, false);
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest b/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/auth/iframe.php b/LayoutTests/http/tests/appcache/resources/auth/iframe.php
new file mode 100644
index 0000000..7e5d30d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/auth/iframe.php
@@ -0,0 +1,16 @@
+<?php
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'Authentication canceled';
+ exit;
+ } else {
+ echo "<html manifest='manifest.php'>\n";
+ echo "<p>Subframe, should disappear.</p>\n";
+ echo "<script>\n";
+ echo " applicationCache.oncached = parent.success;\n";
+ echo " applicationCache.onnoupdate = parent.success;\n";
+ echo "</script>\n";
+ echo "</html>\n";
+ }
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/auth/manifest.php b/LayoutTests/http/tests/appcache/resources/auth/manifest.php
new file mode 100644
index 0000000..ea09957
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/auth/manifest.php
@@ -0,0 +1,12 @@
+<?php
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'Authentication canceled';
+ exit;
+ } else {
+ header("Content-Type: text/cache-manifest");
+ echo "CACHE MANIFEST\n";
+ echo "subresource.php\n";
+ }
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/auth/setup.php b/LayoutTests/http/tests/appcache/resources/auth/setup.php
new file mode 100644
index 0000000..c0f3965
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/auth/setup.php
@@ -0,0 +1,10 @@
+<?php
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'Authentication canceled';
+ exit;
+ } else {
+ echo "OK\n";
+ }
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/auth/subresource.php b/LayoutTests/http/tests/appcache/resources/auth/subresource.php
new file mode 100644
index 0000000..0945d53
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/auth/subresource.php
@@ -0,0 +1,10 @@
+<?php
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ header('WWW-Authenticate: Basic realm="WebKit AppCache Test Realm"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'Authentication canceled';
+ exit;
+ } else {
+ echo "/* Empty subresource */";
+ }
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/counter.php b/LayoutTests/http/tests/appcache/resources/counter.php
new file mode 100644
index 0000000..7926faf
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/counter.php
@@ -0,0 +1,23 @@
+<?php
+require_once '../../resources/portabilityLayer.php';
+
+$tmpFile = sys_get_temp_dir() . "/" . "appcache_counter";
+
+function stepCounter($file)
+{
+ if (!file_exists($file)) {
+ file_put_contents($file, "0");
+ return "0";
+ }
+ $value = file_get_contents($file);
+ file_put_contents($file, ++$value);
+ return $value;
+}
+
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header("Content-Type: text/plain");
+
+print(stepCounter($tmpFile));
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html
new file mode 100644
index 0000000..28bbeb3
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.html
@@ -0,0 +1,22 @@
+<html manifest="crash-when-navigating-away-then-back.manifest">
+<script>
+
+function cached()
+{
+ window.close();
+ window.opener.closedWindow();
+}
+
+function noupdate()
+{
+ window.opener.document.getElementById('result').innerHTML = 'SUCCESS';
+ window.close();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+applicationCache.addEventListener('noupdate', noupdate, false);
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest
new file mode 100644
index 0000000..a9fb276
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/crash-when-navigating-away-then-back.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+crash-when-navigating-away-then-back.html
diff --git a/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html b/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html
new file mode 100644
index 0000000..a97c508
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/cyrillic-uri-form.html
@@ -0,0 +1,28 @@
+<html manifest="cyrillic-uri.manifest">
+<head>
+<meta charset="koi8-r">
+</head>
+<body>
+<form method=GET action="?">
+<input type=text name=i value="ðÒÏ×ÅÒËÁ">
+</form>
+<script>
+document.write(location);
+function test() {
+ if (location.search == "") {
+ document.forms[0].submit();
+ } else if (location.search == "?i=%F0%D2%CF%D7%C5%D2%CB%C1") {
+ document.forms[0].elements[0].value="ðÒÏ×ÅÒËÁ-2";
+ document.forms[0].submit();
+ } else if (location.search == "?i=%F0%D2%CF%D7%C5%D2%CB%C1-2") {
+ parent.postMessage("allDone", "*");
+ } else {
+ alert("Unexpected URI: " + location);
+ parent.postMessage("allDone", "*");
+ }
+}
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest b/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest
new file mode 100644
index 0000000..574ab9e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/cyrillic-uri.manifest
@@ -0,0 +1,10 @@
+CACHE MANIFEST
+intercept/cached-Проверка
+intercept/cached2-%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0
+cyrillic-uri-form.html
+cyrillic-uri-form.html?i=Проверка
+NETWORK:
+intercept/network-Проверка
+cyrillic-uri-form.html?i=Проверка-2
+FALLBACK:
+does-not-exist-Проверка intercept/fallback-Проверка
diff --git a/LayoutTests/http/tests/appcache/resources/different-scheme.manifest b/LayoutTests/http/tests/appcache/resources/different-scheme.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/different-scheme.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/empty.manifest b/LayoutTests/http/tests/appcache/resources/empty.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/empty.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/empty.txt b/LayoutTests/http/tests/appcache/resources/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/empty.txt
diff --git a/LayoutTests/http/tests/appcache/resources/fail-on-update.php b/LayoutTests/http/tests/appcache/resources/fail-on-update.php
new file mode 100644
index 0000000..b66da78
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/fail-on-update.php
@@ -0,0 +1,38 @@
+<?php
+require_once '../../resources/portabilityLayer.php';
+
+$tmpFile = sys_get_temp_dir() . "/" . "fail_on_update_state";
+
+function setState($newState, $file)
+{
+ file_put_contents($file, $newState);
+}
+
+function getState($file)
+{
+ if (!file_exists($file)) {
+ return "Uninitialized";
+ }
+ return file_get_contents($file);
+}
+
+$command = $_GET['command'];
+$state = getState($tmpFile);
+
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+
+if ($command == "reset") {
+ unlink($tmpFile);
+} else if ($command == "delete") {
+ setState("Deleted", $tmpFile);
+} else if ($state == "Uninitialized") {
+ header("Content-Type: text/cache-manifest");
+ print("CACHE MANIFEST\n");
+ print("NETWORK:\n");
+ print("fail-on-update.php?command=\n");
+} else if ($state == "Deleted") {
+ header('HTTP/1.0 404 Not Found');
+}
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/fallback-redirect.php b/LayoutTests/http/tests/appcache/resources/fallback-redirect.php
new file mode 100644
index 0000000..deb101a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/fallback-redirect.php
@@ -0,0 +1,8 @@
+<?php
+ header('HTTP/1.1 307 Temporary Redirect');
+ header('Location: http://localhost:8000/appcache/resources/simple.txt');
+
+ header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Pragma: no-cache");
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/fallback.manifest b/LayoutTests/http/tests/appcache/resources/fallback.manifest
new file mode 100644
index 0000000..7375c7d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/fallback.manifest
@@ -0,0 +1,5 @@
+CACHE MANIFEST
+FALLBACK:
+/resources/network-simulator.php? simple.txt
+fallback-redirect simple.txt
+does-not-exist simple.txt \ No newline at end of file
diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js b/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js
new file mode 100644
index 0000000..01b2b2a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe-subresource.js
@@ -0,0 +1 @@
+parent.postMessage("allDone", "*");
diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe.html b/LayoutTests/http/tests/appcache/resources/foreign-iframe.html
new file mode 100644
index 0000000..0b008bc
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe.html
@@ -0,0 +1,4 @@
+<html manifest="foreign-iframe.manifest">
+<div>Subframe</div>
+<script src="foreign-iframe-subresource.js"></script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest b/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest
new file mode 100644
index 0000000..fc0c2f9
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/foreign-iframe.manifest
@@ -0,0 +1,4 @@
+CACHE MANIFEST
+simple.txt
+foreign-iframe.html
+foreign-iframe-subresource.js
diff --git a/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest b/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/idempotent-update.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/intercept/.htaccess b/LayoutTests/http/tests/appcache/resources/intercept/.htaccess
new file mode 100644
index 0000000..bfd3b30
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/intercept/.htaccess
@@ -0,0 +1,2 @@
+RewriteEngine on
+RewriteRule ^.* /appcache/resources/print-uri.php [L,NS]
diff --git a/LayoutTests/http/tests/appcache/resources/local-content.manifest b/LayoutTests/http/tests/appcache/resources/local-content.manifest
new file mode 100644
index 0000000..d62c274
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/local-content.manifest
@@ -0,0 +1,4 @@
+CACHE MANIFEST
+/appcache/local-content.html
+NETWORK:
+file:/ # Should be ignored due to different URL scheme, but it doesn't hurt to try.
diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html
new file mode 100644
index 0000000..6fc1260
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.html
@@ -0,0 +1,27 @@
+<html manifest="/appcache/resources/main-resource-hash-frame.manifest#foo">
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+applicationCache.onchecking = function() { log("checking"); }
+applicationCache.ondownloading = function() { log("downloading") }
+applicationCache.onprogress = function() { log("progress") }
+applicationCache.onupdateready = function() { log("updateready") }
+applicationCache.onobsolete = function() { log("obsolete") }
+applicationCache.oncached = function() { log("cached"); loaded(); }
+applicationCache.onnoupdate = function() { log("noupdate"); loaded(); }
+applicationCache.onerror = function() { log("error"); loaded(); }
+
+var once = 1;
+function loaded()
+{
+ if (once) {
+ once = 0;
+ parent.postMessage("loaded", "*");
+ }
+}
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/main-resource-hash-frame.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest b/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest
new file mode 100644
index 0000000..eb5c126
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/manifest-containing-itself.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+manifest-containing-itself.manifest
diff --git a/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest b/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest
new file mode 100644
index 0000000..db694ac
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/manifest-parsing.manifest
@@ -0,0 +1,6 @@
+CACHE MANIFEST ignored text
+ empty.txt
+
+simple.txt ignored text
+UNKNOWN_SECTION:
+not-in-cache.txt
diff --git a/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php b/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php
new file mode 100644
index 0000000..e3bc158
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/manifest-redirect-2.php
@@ -0,0 +1,7 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: manifest-redirect-2.php');
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/manifest-redirect.php b/LayoutTests/http/tests/appcache/resources/manifest-redirect.php
new file mode 100644
index 0000000..e2f32eb
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/manifest-redirect.php
@@ -0,0 +1,7 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: simple.manifest');
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest b/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest
new file mode 100644
index 0000000..aab054b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/manifest-with-empty-file.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+empty.txt
diff --git a/LayoutTests/http/tests/appcache/resources/maxsize.manifest b/LayoutTests/http/tests/appcache/resources/maxsize.manifest
new file mode 100644
index 0000000..934fa6c
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/maxsize.manifest
@@ -0,0 +1,3 @@
+CACHE MANIFEST
+#v1
+abe.png
diff --git a/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest b/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest
new file mode 100644
index 0000000..10f6ddb
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/navigating-away-while-cache-attempt-in-progress.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+slow-resource.php
diff --git a/LayoutTests/http/tests/appcache/resources/non-html.manifest b/LayoutTests/http/tests/appcache/resources/non-html.manifest
new file mode 100644
index 0000000..dc8db7a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/non-html.manifest
@@ -0,0 +1,8 @@
+CACHE MANIFEST
+/appcache/non-html.xhtml
+/resources/network-simulator.php?path=/appcache/resources/simple.txt
+/resources/network-simulator.php?path=/appcache/resources/abe.png
+/resources/network-simulator.php?path=/appcache/resources/non-html.manifest
+NETWORK:
+/favicon.ico
+/resources/network-simulator.php?command=
diff --git a/LayoutTests/http/tests/appcache/resources/not-in-cache.txt b/LayoutTests/http/tests/appcache/resources/not-in-cache.txt
new file mode 100644
index 0000000..a580081
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/not-in-cache.txt
@@ -0,0 +1 @@
+This file is not in the cache and is thus not possible to load. \ No newline at end of file
diff --git a/LayoutTests/http/tests/appcache/resources/offline-access-frame.html b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
new file mode 100644
index 0000000..68ef274
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/offline-access-frame.html
@@ -0,0 +1,30 @@
+<html manifest="/resources/network-simulator.php?path=/appcache/resources/offline-access.manifest">
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+applicationCache.onchecking = function() { log("checking"); }
+applicationCache.ondownloading = function() { log("downloading") }
+applicationCache.onprogress = function() { log("progress") }
+applicationCache.onupdateready = function() { log("updateready") }
+applicationCache.onobsolete = function() { log("obsolete") }
+</script>
+<script src="/resources/network-simulator.php?path=/appcache/resources/offline-access.js"></script>
+<script>
+
+applicationCache.oncached = function() { log("cached"); test() }
+applicationCache.onnoupdate = function() { log("noupdate"); test() }
+applicationCache.onerror = function() { log("error"); test() }
+
+if (applicationCache.status == applicationCache.IDLE) {
+ // Update finished while we were waiting for offline-access.js to load.
+ applicationCache.oncached = function() { log("cached") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onerror = function() { log("error") }
+ test();
+}
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/offline-access.js b/LayoutTests/http/tests/appcache/resources/offline-access.js
new file mode 100644
index 0000000..a69d73e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/offline-access.js
@@ -0,0 +1,18 @@
+function test()
+{
+ applicationCache.oncached = function() { log("cached") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onerror = function() { log("error") }
+
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "/resources/network-simulator.php?path=/appcache/resources/simple.txt", false);
+ req.send(null);
+ if (req.responseText == "Hello, World!")
+ parent.postMessage("done", "*");
+ else
+ alert("FAIL, unexpected response: " + ex);
+ } catch (ex) {
+ alert("FAIL, unexpected error: " + ex);
+ }
+}
diff --git a/LayoutTests/http/tests/appcache/resources/offline-access.manifest b/LayoutTests/http/tests/appcache/resources/offline-access.manifest
new file mode 100644
index 0000000..5142e38
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/offline-access.manifest
@@ -0,0 +1,5 @@
+CACHE MANIFEST
+/resources/network-simulator.php?path=/appcache/resources/offline-access-frame.html
+/resources/network-simulator.php?path=/appcache/resources/offline-access.manifest
+/resources/network-simulator.php?path=/appcache/resources/simple.txt
+/resources/network-simulator.php?path=/appcache/resources/offline-access.js
diff --git a/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest b/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest
new file mode 100644
index 0000000..892bf8d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/online-whitelist.manifest
@@ -0,0 +1,14 @@
+CACHE MANIFEST
+counter.php?cached
+
+NETWORK:
+# These are prefixes for requests we test, but they are not same origin, so they will be skipped.
+http://
+http://127
+http://127.0.0.1:8
+
+# This should be ignored, because explicit entries are checked before online whitelist
+counter.php?cached
+
+# This should work normally.
+counter.php?uncached \ No newline at end of file
diff --git a/LayoutTests/http/tests/appcache/resources/print-uri.php b/LayoutTests/http/tests/appcache/resources/print-uri.php
new file mode 100644
index 0000000..23358f1
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/print-uri.php
@@ -0,0 +1,7 @@
+<?php
+ header("Content-Type: text/javascript");
+ header("Expires: Thu, 01 Dec 2003 16:00:00 GMT\n");
+ header("Cache-Control: no-cache, must-revalidate\n");
+ header("Pragma: no-cache\n");
+ echo $_SERVER['REQUEST_URI'];
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/reload-iframe.html b/LayoutTests/http/tests/appcache/resources/reload-iframe.html
new file mode 100644
index 0000000..7575bab
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/reload-iframe.html
@@ -0,0 +1,21 @@
+<html manifest="reload-iframe.manifest">
+<body>
+<script>
+function test()
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "resources/not-in-cache.txt", false);
+ req.send("");
+ parent.postMessage("FAIL: Loading an uncached resource didn't raise an exception", "*");
+ } catch (e) {
+ parent.postMessage("SUCCESS", "*");
+ }
+}
+
+applicationCache.onnoupdate = function() { parent.postMessage("Frame loaded", "*") }
+applicationCache.oncached = function() { parent.postMessage("Frame loaded", "*") }
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest b/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest
new file mode 100644
index 0000000..668f974
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/reload-iframe.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+/appcache/resources/simple.txt
diff --git a/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html b/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html
new file mode 100644
index 0000000..009a8b6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/remove-cache-frame-2.html
@@ -0,0 +1,37 @@
+<html manifest="fail-on-update.php">
+<body>
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ log("cached")
+ log("status=" + applicationCache.status);
+ applicationCache.onnoupdate = null;
+
+ // Associated to a cache, so loading should fail
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "empty.txt", false);
+ req.send(null);
+ alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception");
+ } catch (ex) {
+ }
+ log("There should be no messages below.");
+ parent.postMessage("frameDone", "*");
+}
+
+applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected onupdateready event in frame") }
+applicationCache.onerror = function() { log("error"); alert("Unexpected error event in frame") }
+applicationCache.onnoupdate = function() { log("noupdate"); alert("Unexpected noupdate event in frame") }
+applicationCache.onobsolete = function() { log("obsolete"); alert("Unexpected obsolete event in frame") }
+
+applicationCache.oncached = test;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html
new file mode 100644
index 0000000..30e8553
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/remove-cache-frame.html
@@ -0,0 +1,64 @@
+<html manifest="fail-on-update.php">
+<body>
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function onObsolete()
+{
+ log("obsolete")
+ log("status=" + applicationCache.status + " (expected 5)");
+ applicationCache.onobsolete = function() { log("obsolete") }
+ applicationCache.onupdateready = function() { log("updateready") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onnoupdate = function() { log("error") }
+
+ // We still have a cache, so loading should fail
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "empty.txt", false);
+ req.send(null);
+ alert("FAIL: XMLHttpRequest for an uncached resource didn't raise an exception");
+ } catch (ex) {
+ }
+ log("There should be no messages below.");
+}
+
+function onError()
+{
+ if (applicationCache.status != applicationCache.UNCACHED && applicationCache.status != applicationCache.OBSOLETE) {
+ timeoutId = setTimeout(onNoManifest, 100);
+ return;
+ }
+
+ log("error");
+ applicationCache.onobsolete = function() { log("obsolete") }
+ applicationCache.onupdateready = function() { log("updateready") }
+ applicationCache.onnoupdate = function() { log("noupdate") }
+ applicationCache.onnoupdate = function() { log("error") }
+
+ // Ensure that we are not associated with a cache.
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "empty.txt", false);
+ req.send(null);
+ } catch (ex) {
+ alert("FAIL: XMLHttpRequest raised an exception, " + ex);
+ }
+ log("There should be no messages below.");
+ parent.postMessage("frameDone - timeout", "*");
+}
+
+applicationCache.onupdateready = function() { log("updateready"); alert("Unexpected updateready event in frame") }
+applicationCache.onnoupdate = function() { log("noupdate") }
+applicationCache.oncached = function() { log("cached"); alert("Unexpected cached event in frame") }
+
+applicationCache.onobsolete = onObsolete;
+applicationCache.onerror = onError;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest
new file mode 100644
index 0000000..66cd3fe
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+resource-redirect-2.php
diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php
new file mode 100644
index 0000000..ac1e8f5
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/resource-redirect-2.php
@@ -0,0 +1,7 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: resource-redirect-2.php');
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest b/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest
new file mode 100644
index 0000000..e94651d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/resource-redirect.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+resource-redirect.php
diff --git a/LayoutTests/http/tests/appcache/resources/resource-redirect.php b/LayoutTests/http/tests/appcache/resources/resource-redirect.php
new file mode 100644
index 0000000..07931fb
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/resource-redirect.php
@@ -0,0 +1,7 @@
+<?php
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('HTTP/1.1 307 Temporary Redirect');
+header('Location: simple.txt');
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/simple.manifest b/LayoutTests/http/tests/appcache/resources/simple.manifest
new file mode 100644
index 0000000..3a210f3
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/simple.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+simple.txt
diff --git a/LayoutTests/http/tests/appcache/resources/simple.txt b/LayoutTests/http/tests/appcache/resources/simple.txt
new file mode 100644
index 0000000..b45ef6f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/simple.txt
@@ -0,0 +1 @@
+Hello, World! \ No newline at end of file
diff --git a/LayoutTests/http/tests/appcache/resources/slow-resource.php b/LayoutTests/http/tests/appcache/resources/slow-resource.php
new file mode 100644
index 0000000..b720ba1
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/slow-resource.php
@@ -0,0 +1,3 @@
+<?php
+sleep(10);
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/subframe-1.html b/LayoutTests/http/tests/appcache/resources/subframe-1.html
new file mode 100644
index 0000000..629c030
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframe-1.html
@@ -0,0 +1,7 @@
+<script>
+var req = new XMLHttpRequest;
+req.open("GET", "simple.txt", false);
+req.send(null);
+if (req.responseText.length > 0)
+ parent.postMessage("allDone", "*");
+</script>
diff --git a/LayoutTests/http/tests/appcache/resources/subframe-2.html b/LayoutTests/http/tests/appcache/resources/subframe-2.html
new file mode 100644
index 0000000..9fb6c0f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframe-2.html
@@ -0,0 +1,11 @@
+<script>
+try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "simple.txt", false);
+ req.send(null);
+ alert("FAIL, unexpected response: " + req.responseText);
+} catch (ex) {
+ // Loading should fail, because simple.txt is not in cache manifest.
+ parent.postMessage("allDone", "*");
+}
+</script>
diff --git a/LayoutTests/http/tests/appcache/resources/subframe-3.html b/LayoutTests/http/tests/appcache/resources/subframe-3.html
new file mode 100644
index 0000000..b708408
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframe-3.html
@@ -0,0 +1,26 @@
+<html manifest="subframes-3.manifest">
+<script>
+function test()
+{
+ applicationCache.onnoupdate = null;
+
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "simple.txt", false);
+ req.send(null);
+ alert("FAIL, unexpected response: " + req.responseText);
+ } catch (ex) {
+ // Loading should fail, because simple.txt is not in cache manifest.
+ parent.postMessage("allDone", "*");
+ }
+}
+
+// The cache has been fully created before the iframe was inserted, and the manifest didn't change.
+applicationCache.onnoupdate = test;
+
+applicationCache.onupdateready = function() { alert("Unexpected updateready event") }
+applicationCache.oncached = function() { alert("Unexpected cached event") }
+applicationCache.onerror = function() { alert("Unexpected error event") }
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/subframe-4.html b/LayoutTests/http/tests/appcache/resources/subframe-4.html
new file mode 100644
index 0000000..da03679
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframe-4.html
@@ -0,0 +1,26 @@
+<html manifest="subframes-4.manifest">
+<script>
+function test()
+{
+ applicationCache.onnoupdate = null;
+
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "simple.txt", false);
+ req.send(null);
+ alert("FAIL, unexpected response: " + req.responseText);
+ } catch (ex) {
+ // Loading should fail, because simple.txt is not in cache manifest.
+ parent.postMessage("allDone", "*");
+ }
+}
+
+// The cache has been fully created before the iframe was inserted, and the manifest didn't change.
+applicationCache.onnoupdate = test;
+
+applicationCache.onupdateready = function() { alert("Unexpected updateready event") }
+applicationCache.oncached = function() { alert("Unexpected cached event") }
+applicationCache.onerror = function() { alert("Unexpected error event") }
+
+</script>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/subframes-1.manifest b/LayoutTests/http/tests/appcache/resources/subframes-1.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframes-1.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/subframes-2.manifest b/LayoutTests/http/tests/appcache/resources/subframes-2.manifest
new file mode 100644
index 0000000..645a34f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframes-2.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+subframe-2.html
diff --git a/LayoutTests/http/tests/appcache/resources/subframes-3.manifest b/LayoutTests/http/tests/appcache/resources/subframes-3.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframes-3.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/subframes-4.manifest b/LayoutTests/http/tests/appcache/resources/subframes-4.manifest
new file mode 100644
index 0000000..f4e7937
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/subframes-4.manifest
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+subframe-4.html
diff --git a/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php b/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php
new file mode 100644
index 0000000..ddfe07d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/uncacheable-resource.php
@@ -0,0 +1,13 @@
+<?php
+# This resource won't be cached by network layer, but will be cached by appcache.
+header("Last-Modified: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, no-store");
+header("Pragma: no-cache");
+header("Content-Type: text/plain");
+
+if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] || $_SERVER['HTTP_IF_NONE_MATCH'])
+ header("HTTP/1.1 304 Not Modified");
+else
+ print("Hello, world!\n");
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/versioned-manifest.php b/LayoutTests/http/tests/appcache/resources/versioned-manifest.php
new file mode 100644
index 0000000..84a7a91
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/versioned-manifest.php
@@ -0,0 +1,37 @@
+<?php
+require_once '../../resources/portabilityLayer.php';
+
+$tmpFile = sys_get_temp_dir() . "/" . "appcache_manifest_counter";
+
+function getCount($file)
+{
+ if (!file_exists($file)) {
+ file_put_contents($file, "0");
+ return "0";
+ }
+ return file_get_contents($file);
+}
+
+function stepCounter($file)
+{
+ if (file_exists($file)) {
+ $value = getCount($file);
+ file_put_contents($file, ++$value);
+ }
+}
+
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header("Content-Type: text/cache-manifest");
+
+if ("step" == $_GET['command'])
+ stepCounter($tmpFile);
+
+print("CACHE MANIFEST\n");
+print("# version " . getCount($tmpFile) . "\n");
+print("counter.php\n");
+print("uncacheable-resource.php\n"); // with Cache-control: no-store
+print("NETWORK:\n");
+print("versioned-manifest.php?command=\n");
+?>
diff --git a/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest b/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest
new file mode 100644
index 0000000..8f88a4a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/whitelist-wildcard.manifest
@@ -0,0 +1,3 @@
+CACHE MANIFEST
+NETWORK:
+*
diff --git a/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest b/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/wrong-content-type.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest b/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest
new file mode 100644
index 0000000..d7d3f8d
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/wrong-signature-2.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST;V2
diff --git a/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest b/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest
new file mode 100644
index 0000000..aab49be
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/wrong-signature.manifest
@@ -0,0 +1 @@
+A CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest
new file mode 100644
index 0000000..af16a0e
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-2.manifest
@@ -0,0 +1 @@
+CACHE MANIFEST
diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html
new file mode 100644
index 0000000..57093fa
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource-frame.html
@@ -0,0 +1,36 @@
+<html manifest="xhr-foreign-resource-2.manifest">
+<body>
+<div id=result></div>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cached()
+{
+ applicationCache.onnoupdate = null;
+ applicationCache.oncached = null;
+
+ // simple.txt is only listed s a resource in main frame's manifest, so loading should fail.
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "simple.txt", false);
+ req.send("");
+ log("FAIL");
+ log("applicationCache.status = " + applicationCache.status);
+ parent.postMessage("FAIL", "*");
+ } catch (ex) {
+ log("Frame OK");
+ parent.postMessage("SUCCESS", "*");
+ }
+}
+
+applicationCache.onnoupdate = cached;
+applicationCache.oncached = cached;
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest
new file mode 100644
index 0000000..8cfe428
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/resources/xhr-foreign-resource.manifest
@@ -0,0 +1,3 @@
+CACHE MANIFEST
+xhr-foreign-resource-frame.html
+simple.txt
diff --git a/LayoutTests/http/tests/appcache/simple-expected.txt b/LayoutTests/http/tests/appcache/simple-expected.txt
new file mode 100644
index 0000000..1c1a58c
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/simple-expected.txt
@@ -0,0 +1,2 @@
+This tests that the application cache works by first loading a file that does not exist in the cache (to verify that a cache has been associated) and then loads a file that is in the cache
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/simple.html b/LayoutTests/http/tests/appcache/simple.html
new file mode 100644
index 0000000..4342cb7
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/simple.html
@@ -0,0 +1,55 @@
+<html manifest="resources/simple.manifest">
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function cached()
+{
+ var hadError = false;
+
+ // Load a resource that does not exist in the cache.
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "resources/not-in-cache.txt", false);
+ req.send();
+ } catch (e) {
+ if (e.code == XMLHttpRequestException.NETWORK_ERR)
+ hadError = true;
+ }
+
+ if (!hadError) {
+ document.getElementById('result').innerHTML = "FAILURE: Did not get the right exception"
+ return;
+ }
+
+ // Load a resource that exists in the cache.
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", "resources/simple.txt", false);
+ req.send();
+ } catch (e) {
+ document.getElementById('result').innerHTML = "FAILURE: Could not load data from cache"
+ return;
+ }
+
+ if (req.responseText != 'Hello, World!') {
+ document.getElementById('result').innerHTML = "FAILURE: Did not get correct data from cached resource"
+ return;
+ }
+
+ document.getElementById('result').innerHTML = "SUCCESS"
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', cached, false);
+applicationCache.addEventListener('noupdate', cached, false);
+
+</script>
+<div>This tests that the application cache works by first loading a file that does not exist in the cache (to verify that a cache has been associated) and then loads a file that is in the cache</div>
+
+<div id="result">FAILURE</div>
+</html>
diff --git a/LayoutTests/http/tests/appcache/top-frame-1-expected.txt b/LayoutTests/http/tests/appcache/top-frame-1-expected.txt
new file mode 100644
index 0000000..c7f7e37
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-1-expected.txt
@@ -0,0 +1,8 @@
+Test that a subframe without manifest doesn't pick an application cache from parent frame (as long as no relevant cache contains its resource).
+
+Techically, the check is that iframe subresources that are not in top frame cache are loaded anyway, so it can also pass if the UA fails to reject loads for cache misses.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/top-frame-1.html b/LayoutTests/http/tests/appcache/top-frame-1.html
new file mode 100644
index 0000000..9e29300
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-1.html
@@ -0,0 +1,38 @@
+<html manifest="resources/subframes-1.manifest">
+<body>
+<p>Test that a subframe without manifest doesn't pick an application cache from parent frame
+(as long as no relevant cache contains its resource).</p>
+<p>Techically, the check is that iframe subresources that are not in top frame cache are loaded
+anyway, so it can also pass if the UA fails to reject loads for cache misses.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-1.html");
+ document.body.appendChild(ifr);
+}
+
+applicationCache.addEventListener('noupdate', function() { test() }, false);
+applicationCache.addEventListener('cached', function() { test() }, false);
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+window.addEventListener("message", function() { log("SUCCESS"); if (window.layoutTestController) layoutTestController.notifyDone() }, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/top-frame-2-expected.txt b/LayoutTests/http/tests/appcache/top-frame-2-expected.txt
new file mode 100644
index 0000000..6e99bb6
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-2-expected.txt
@@ -0,0 +1,7 @@
+Test that a subframe without manifest gets picked by a relevant application cache that contains its resource.
+
+Should say SUCCESS:
+
+checking
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/top-frame-2.html b/LayoutTests/http/tests/appcache/top-frame-2.html
new file mode 100644
index 0000000..c239d08
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-2.html
@@ -0,0 +1,42 @@
+<html manifest="resources/subframes-2.manifest">
+<body>
+<p>Test that a subframe without manifest gets picked by a relevant application cache that
+contains its resource.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ applicationCache.onnoupdate = null;
+ applicationCache.oncached = null;
+
+ // When a new main resource is associated with the cache, an update should be started.
+ applicationCache.onchecking = function() { log("checking") }
+
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-2.html");
+ document.body.appendChild(ifr);
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+window.addEventListener("message", function() { log("SUCCESS"); if (window.layoutTestController) layoutTestController.notifyDone() }, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/top-frame-3-expected.txt b/LayoutTests/http/tests/appcache/top-frame-3-expected.txt
new file mode 100644
index 0000000..a10dbee
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-3-expected.txt
@@ -0,0 +1,10 @@
+Test that a subframe with manifest that matches top frame manifest works correctly.
+
+In this case, the subframe resource is NOT listed in manifest explicitly.
+
+Should say SUCCESS:
+
+checking
+checking
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/top-frame-3.html b/LayoutTests/http/tests/appcache/top-frame-3.html
new file mode 100644
index 0000000..9fc9dde
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-3.html
@@ -0,0 +1,60 @@
+<html manifest="resources/subframes-3.manifest">
+<body>
+<p>Test that a subframe with manifest that matches top frame manifest works correctly.</p>
+<p>In this case, the subframe resource is NOT listed in manifest explicitly.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ applicationCache.onnoupdate = null;
+ applicationCache.oncached = null;
+
+ // When a new main resource is associated with the cache, an update should be started.
+ applicationCache.onchecking = function() { log("checking") }
+
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-3.html");
+ document.body.appendChild(ifr);
+}
+
+function test2()
+{
+ window.removeEventListener("message", test2, false);
+ window.addEventListener("message", test3, false);
+
+ // Add an identical frame, to test that loading its resources from appcache works.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-3.html");
+ document.body.appendChild(ifr);
+}
+
+function test3()
+{
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+window.addEventListener("message", test2, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/top-frame-4-expected.txt b/LayoutTests/http/tests/appcache/top-frame-4-expected.txt
new file mode 100644
index 0000000..43bfd43
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-4-expected.txt
@@ -0,0 +1,10 @@
+Test that a subframe with manifest that matches top frame manifest works correctly.
+
+In this case, the subframe resource is listed in manifest explicitly.
+
+Should say SUCCESS:
+
+checking
+checking
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/top-frame-4.html b/LayoutTests/http/tests/appcache/top-frame-4.html
new file mode 100644
index 0000000..39743b9
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/top-frame-4.html
@@ -0,0 +1,60 @@
+<html manifest="resources/subframes-4.manifest">
+<body>
+<p>Test that a subframe with manifest that matches top frame manifest works correctly.</p>
+<p>In this case, the subframe resource is listed in manifest explicitly.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function test()
+{
+ applicationCache.onnoupdate = null;
+ applicationCache.oncached = null;
+
+ // When a new main resource is associated with the cache, an update should be started.
+ applicationCache.onchecking = function() { log("checking") }
+
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-4.html");
+ document.body.appendChild(ifr);
+}
+
+function test2()
+{
+ window.removeEventListener("message", test2, false);
+ window.addEventListener("message", test3, false);
+
+ // Add an identical frame, to test that loading its resources from appcache works.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/subframe-4.html");
+ document.body.appendChild(ifr);
+}
+
+function test3()
+{
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+window.addEventListener("message", test2, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/update-cache-expected.txt b/LayoutTests/http/tests/appcache/update-cache-expected.txt
new file mode 100644
index 0000000..a6d95d4
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/update-cache-expected.txt
@@ -0,0 +1,10 @@
+Test a simple offline application self-update process. Should print a series of messages followed with DONE:
+
+Updating cache group...
+Cache status is UPDATEREADY
+Updating cache group once more...
+Cache status is UPDATEREADY
+Associating document with the newest cache version...
+Cache status is IDLE
+DONE
+
diff --git a/LayoutTests/http/tests/appcache/update-cache.html b/LayoutTests/http/tests/appcache/update-cache.html
new file mode 100644
index 0000000..dd48b01
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/update-cache.html
@@ -0,0 +1,69 @@
+<html manifest="resources/versioned-manifest.php">
+<body>
+<p>Test a simple offline application self-update process. Should print a series of messages followed with DONE:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function modifyManifest()
+{
+ var req = new XMLHttpRequest;
+ req.open("GET", "resources/versioned-manifest.php?command=step", false);
+ req.send(false);
+}
+
+function test()
+{
+ modifyManifest();
+
+ applicationCache.oncached = function() { log("FAIL: Unexpected cached event") }
+ applicationCache.onnoupdate = function() { log("FAIL: Unexpected noupdate event") }
+ applicationCache.onupdateready = function() { setTimeout(test2, 0) }
+
+ log("Updating cache group...");
+ setTimeout("applicationCache.update()", 0);
+}
+
+function test2()
+{
+ log((applicationCache.status == applicationCache.UPDATEREADY) ? "Cache status is UPDATEREADY" : ("FAIL: Incorrect cache status, " + applicationCache.status));
+
+ modifyManifest();
+ applicationCache.onupdateready = function() { setTimeout(test3, 0) }
+
+ log("Updating cache group once more...");
+ setTimeout("applicationCache.update()", 0);
+}
+
+function test3()
+{
+ log((applicationCache.status == applicationCache.UPDATEREADY) ? "Cache status is UPDATEREADY" : ("FAIL: Incorrect cache status, " + applicationCache.status));
+
+ log("Associating document with the newest cache version...");
+ applicationCache.swapCache();
+
+ log((applicationCache.status == applicationCache.IDLE) ? "Cache status is IDLE" : ("FAIL: Incorrect cache status, " + applicationCache.status));
+
+ log("DONE");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.oncached = test;
+applicationCache.onnoupdate = test;
+applicationCache.onupdateready = function() { log("FAIL: Unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: Unexpected error event") }
+applicationCache.onobsolete = function() { log("FAIL: Unexpected obsolete event") }
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/whitelist-wildcard-expected.txt b/LayoutTests/http/tests/appcache/whitelist-wildcard-expected.txt
new file mode 100644
index 0000000..b503f12
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/whitelist-wildcard-expected.txt
@@ -0,0 +1,3 @@
+Test that online whitelist wildcard flag is implemented.
+
+SUCCESS
diff --git a/LayoutTests/http/tests/appcache/whitelist-wildcard.html b/LayoutTests/http/tests/appcache/whitelist-wildcard.html
new file mode 100644
index 0000000..01bc892
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/whitelist-wildcard.html
@@ -0,0 +1,29 @@
+<html manifest="resources/whitelist-wildcard.manifest">
+<body>
+<p>Test that online whitelist wildcard flag is implemented.</p>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function test()
+{
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "resources/empty.txt", false);
+ req.send();
+ document.body.appendChild(document.createTextNode("SUCCESS"));
+ } catch (ex) {
+ document.body.appendChild(document.createTextNode(ex));
+ }
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.oncached = test;
+applicationCache.onnoupdate = test;
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/wrong-content-type-expected.txt b/LayoutTests/http/tests/appcache/wrong-content-type-expected.txt
new file mode 100644
index 0000000..d13447a
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-content-type-expected.txt
@@ -0,0 +1,6 @@
+Test that a manifest served with a wrong content-type isn't treated as such.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/wrong-content-type.html b/LayoutTests/http/tests/appcache/wrong-content-type.html
new file mode 100644
index 0000000..7b3bf6c
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-content-type.html
@@ -0,0 +1,40 @@
+<html manifest="resources/wrong-content-type.manifest">
+<body>
+<p>Test that a manifest served with a wrong content-type isn't treated as such.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated wuth any cache yet.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/wrong-signature-2-expected.txt b/LayoutTests/http/tests/appcache/wrong-signature-2-expected.txt
new file mode 100644
index 0000000..c89843b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-signature-2-expected.txt
@@ -0,0 +1,6 @@
+Test that a manifest served with a wrong signature isn't treated as such.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/wrong-signature-2.html b/LayoutTests/http/tests/appcache/wrong-signature-2.html
new file mode 100644
index 0000000..9b26d02
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-signature-2.html
@@ -0,0 +1,40 @@
+<html manifest="resources/wrong-signature-2.manifest">
+<body>
+<p>Test that a manifest served with a wrong signature isn't treated as such.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated wuth any cache yet.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/wrong-signature-expected.txt b/LayoutTests/http/tests/appcache/wrong-signature-expected.txt
new file mode 100644
index 0000000..c89843b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-signature-expected.txt
@@ -0,0 +1,6 @@
+Test that a manifest served with a wrong signature isn't treated as such.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/wrong-signature.html b/LayoutTests/http/tests/appcache/wrong-signature.html
new file mode 100644
index 0000000..3b5f747
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/wrong-signature.html
@@ -0,0 +1,40 @@
+<html manifest="resources/wrong-signature.manifest">
+<body>
+<p>Test that a manifest served with a wrong signature isn't treated as such.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+ log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated wuth any cache yet.");
+}
+
+function test()
+{
+ // Wait for cache update to finish.
+ if (window.applicationCache.status != window.applicationCache.UNCACHED)
+ log("FAILURE: Unexpected cache status: " + window.applicationCache.status);
+ else
+ log("SUCCESS");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', test, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/xhr-foreign-resource-expected.txt b/LayoutTests/http/tests/appcache/xhr-foreign-resource-expected.txt
new file mode 100644
index 0000000..bf67172
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/xhr-foreign-resource-expected.txt
@@ -0,0 +1,6 @@
+Test that a resource marked as foreign can still be loaded via XHR.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/xhr-foreign-resource.html b/LayoutTests/http/tests/appcache/xhr-foreign-resource.html
new file mode 100644
index 0000000..df08d3f
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/xhr-foreign-resource.html
@@ -0,0 +1,79 @@
+<html manifest="resources/xhr-foreign-resource.manifest">
+<body>
+<p>Test that a resource marked as foreign can still be loaded via XHR.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function createFrame1()
+{
+ applicationCache.onnoupdate = function() { log("FAIL: Unexpected noupdate event") }
+ applicationCache.oncached = function() { log("FAIL: Unexpected cached event") }
+
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/xhr-foreign-resource-frame.html");
+ document.body.appendChild(ifr);
+}
+
+function createFrame2()
+{
+ // A copy that doesn't have its main resource in cache manifest.
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/xhr-foreign-resource-frame.html?");
+ document.body.appendChild(ifr);
+}
+
+applicationCache.onnoupdate = function() { createFrame1() }
+applicationCache.oncached = function() { createFrame1() }
+
+applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
+applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
+
+var hadErrorFromSubframe = false;
+var subframeMessagesReceived = 0;
+function frameMessageReceived(evt)
+{
+ ++subframeMessagesReceived;
+ if (evt.data != "SUCCESS")
+ hadErrorFromSubframe = true;
+ if (subframeMessagesReceived == 1)
+ setTimeout(createFrame2, 0);
+ else if (subframeMessagesReceived == 2)
+ test();
+}
+
+function test(evt)
+{
+ if (!hadErrorFromSubframe) {
+ // The subframe has a different cache, but it is also listed as a resource in main frame's
+ // manifest, so it should be loaded successfully despite being marked as foreign now.
+ try {
+ var req = new XMLHttpRequest;
+ req.open("GET", "resources/xhr-foreign-resource-frame.html", false);
+ req.send("");
+ log("SUCCESS");
+ } catch (ex) {
+ log (ex);
+ }
+ } else
+ log("FAIL: subframe didn't get a correct cache");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+window.addEventListener("message", frameMessageReceived, false);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/storage/change-version-expected.txt b/LayoutTests/storage/change-version-expected.txt
new file mode 100644
index 0000000..c939e36
--- /dev/null
+++ b/LayoutTests/storage/change-version-expected.txt
@@ -0,0 +1,4 @@
+This test verifies that the JS database.changeVersion() function works as expected.
+Finished tests with version 3; expected version: 3
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/change-version-handle-reuse-expected.txt b/LayoutTests/storage/change-version-handle-reuse-expected.txt
new file mode 100644
index 0000000..805c9fb
--- /dev/null
+++ b/LayoutTests/storage/change-version-handle-reuse-expected.txt
@@ -0,0 +1,6 @@
+This tests that a database can be accessed after changing its version. You should see an error about FooBar table below, not about mismatching versions. Also, reloading the page should not cause an assertion failure.
+changeVersion: transaction callback
+changeVersion: success callback
+transaction: statement error callback: no such table: FooBar
+TEST COMPLETE.
+
diff --git a/LayoutTests/storage/change-version-handle-reuse.html b/LayoutTests/storage/change-version-handle-reuse.html
new file mode 100644
index 0000000..de3a5f4
--- /dev/null
+++ b/LayoutTests/storage/change-version-handle-reuse.html
@@ -0,0 +1,71 @@
+<html>
+<head>
+<script>
+function log(message)
+{
+ document.getElementById("result").innerText += message + "\n";
+}
+
+function finishTest()
+{
+ log("TEST COMPLETE.");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ }
+
+ document.getElementById("result").innerText = "";
+
+ try {
+ db = openDatabase("ChangeVersion", "", "Test that changing a database version doesn\'t kill our handle to it", 1);
+ var version = db.version;
+ var newVersion = version ? (parseInt(version) + 1).toString() : "1";
+ db.changeVersion(version, newVersion, function(tx) {
+ log("changeVersion: transaction callback");
+ }, function(error) {
+ log("changeVersion: error callback: " + error.message);
+ }, function() {
+ log("changeVersion: success callback");
+ });
+
+ setTimeout(runTest2, 1000);
+
+ } catch (e) {
+ log("changeVersion exception: " + e);
+ finishTest();
+ }
+}
+
+function runTest2()
+{
+ try {
+ db.transaction(function(tx) {
+ tx.executeSql("SELECT * from FooBar", [], function(tx) {
+ log("transaction: statement callback");
+ finishTest();
+ }, function(tx, error) {
+ log("transaction: statement error callback: " + error.message);
+ finishTest();
+ });
+ });
+ } catch (e) {
+ log("transaction exception: " + e);
+ finishTest();
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<div>This tests that a database can be accessed after changing its version. You should see an error about FooBar table below, not about mismatching versions. Also, reloading the page should not cause an assertion failure.
+<pre id="result">
+FAILURE: test didn't run.
+</pre>
+</body>
+</html>
diff --git a/LayoutTests/storage/change-version.html b/LayoutTests/storage/change-version.html
new file mode 100644
index 0000000..d81c6b5
--- /dev/null
+++ b/LayoutTests/storage/change-version.html
@@ -0,0 +1,90 @@
+<html>
+<head>
+<title>Test database.changeVersion</title>
+<script>
+var db;
+var EXPECTED_VERSION_AFTER_HIXIE_TEST = '2';
+var EXPECTED_VERSION_AFTER_RELOAD = '3';
+
+function emptyFunction() { }
+
+function changeVersionCallback(tx)
+{
+ tx.executeSql("DROP table if exists info;", [], emptyFunction, emptyFunction);
+ tx.executeSql("CREATE table if not exists info (version INTEGER);", [], emptyFunction, emptyFunction);
+ tx.executeSql("INSERT into info values(?);", [EXPECTED_VERSION_AFTER_RELOAD], emptyFunction, emptyFunction);
+}
+
+function changeVersionSuccess()
+{
+ log("Successfully changed version to ' + db.version + '. Reloading.");
+ window.location.href = window.location + '?2';
+}
+
+function changeVersionError(error)
+{
+ log("Error: " + error.message);
+ finishTest();
+}
+
+function finishTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ log("TEST COMPLETE");
+}
+
+function log(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+function runTest()
+{
+ if (window.location.search == "?2") {
+ db = window.openDatabase("changeversion-test", "", "Test for the database.changeVersion() function", 1024);
+ log("Finished tests with version " + db.version + "; expected version: " + EXPECTED_VERSION_AFTER_RELOAD);
+ finishTest();
+ } else
+ testPart1();
+}
+
+function testPart1() {
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ db = window.openDatabase("changeversion-test", "", "Test for the database.changeVersion() function", 1024);
+
+ if (db.version != EXPECTED_VERSION_AFTER_RELOAD) {
+ // First run Hixie's test to ensure basic changeVersion functionality works (see bug 28418).
+ db.changeVersion("", EXPECTED_VERSION_AFTER_HIXIE_TEST, emptyFunction, function (e) {
+ log('FAIL in changeVersion:' + e);
+ finishTest();
+ }, function () {
+ try {
+ var db2 = openDatabase("change-version-test", EXPECTED_VERSION_AFTER_HIXIE_TEST, "", 0);
+ } catch (e) {
+ log('FAIL in openDatabase: ' + e);
+ finishTest();
+ }
+ // The two database versions should match.
+ if (db.version == db2.version)
+ log("PASS: db.version(" + db.version + ") matches db2.version(" + db2.version +") as expected.");
+ else
+ log("FAIL: db.version(" + db.version + ") does not match db2.version(" + db2.version +")");
+
+ // Now try a test to ensure the version persists after reloading (see bug 27836)
+ db.changeVersion(EXPECTED_VERSION_AFTER_HIXIE_TEST, EXPECTED_VERSION_AFTER_RELOAD, changeVersionCallback, changeVersionError, changeVersionSuccess);
+ });
+ }
+}
+</script>
+</head>
+<body onload="runTest();">
+This test verifies that the JS database.changeVersion() function works as expected.
+<pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/storage/close-during-stress-test-expected.txt b/LayoutTests/storage/close-during-stress-test-expected.txt
new file mode 100644
index 0000000..2aad90c
--- /dev/null
+++ b/LayoutTests/storage/close-during-stress-test-expected.txt
@@ -0,0 +1,5 @@
+Should not crash or cause an assertion failure.
+
+A JavaScript failure on the console is expected, however, as the global object is cleared when closing a frame. It actually helps to cause database activity by throwing an exception from a callback.
+
+
diff --git a/LayoutTests/storage/close-during-stress-test.html b/LayoutTests/storage/close-during-stress-test.html
new file mode 100644
index 0000000..2183e2f
--- /dev/null
+++ b/LayoutTests/storage/close-during-stress-test.html
@@ -0,0 +1,19 @@
+<body>
+<p>Should not crash or cause an assertion failure.</p>
+<p>A JavaScript failure on the console is expected, however, as the global object is cleared when closing a frame.
+It actually helps to cause database activity by throwing an exception from a callback.</p>
+<iframe src="resources/stress-frame.html" onload="startTest()"></iframe>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+}
+
+function startTest()
+{
+ setTimeout("document.getElementsByTagName('iframe')[0].src = 'about:blank'", 100);
+ if (window.layoutTestController)
+ setTimeout("layoutTestController.notifyDone()", 500);
+}
+</script>
+</body>
diff --git a/LayoutTests/storage/database-lock-after-reload-expected.txt b/LayoutTests/storage/database-lock-after-reload-expected.txt
new file mode 100644
index 0000000..2729563
--- /dev/null
+++ b/LayoutTests/storage/database-lock-after-reload-expected.txt
@@ -0,0 +1,3 @@
+Inserting some data
+Test part 2 Complete
+
diff --git a/LayoutTests/storage/database-lock-after-reload.html b/LayoutTests/storage/database-lock-after-reload.html
new file mode 100644
index 0000000..ad34d5b
--- /dev/null
+++ b/LayoutTests/storage/database-lock-after-reload.html
@@ -0,0 +1,69 @@
+<html>
+<head>
+<script>
+var database;
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function finishTest()
+{
+ log("Test part 1 Complete");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function errorFunction(tx, error)
+{
+ log("Test failed - " + error.message);
+ finishTest();
+}
+
+function addData(db)
+{
+ db.transaction(function(tx) {
+ log("Inserting some data");
+ // Insert a large amount of data that will take a little while to run. Schedule a timout to run that will load a new page
+ // whilst the transaction is still in progress, interrupting the transaction. This should not leave the database locked and on
+ // the next page we should be able to insert some more data.
+ tx.executeSql("INSERT INTO DataTest (testData) VALUES (randomBlob(524200 ))", [], function(tx, result) { }, errorFunction);
+ location.href = "./resources/database-lock-after-reload-2.html";
+ }, errorFunction, function() {
+ finishTest();
+ });
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880);
+ } catch (e) {
+ log("Error - could not open database");
+ finishTest();
+ }
+
+ database.transaction(function(tx) {
+ log("Adding a table");
+ tx.executeSql("CREATE TABLE DataTest (testData)", [], function(tx, result) { }, errorFunction);
+ }, errorFunction, function() {
+ addData(database);
+ });
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<pre id="console">
+</pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/domstorage/clear-expected.txt b/LayoutTests/storage/domstorage/clear-expected.txt
new file mode 100644
index 0000000..30dcae1
--- /dev/null
+++ b/LayoutTests/storage/domstorage/clear-expected.txt
@@ -0,0 +1,35 @@
+Test basic dom storage .clear() functionality.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+storage['FOO'] = 'MyFOO'
+storage['BAR'] = 'MyBar'
+PASS storage.length is 2
+PASS storage['FOO'] is "MyFOO"
+PASS storage['BAR'] is "MyBar"
+storage.clear()
+PASS storage.length is 0
+PASS storage['FOO'] is undefined
+PASS storage['BAR'] is undefined
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+storage['FOO'] = 'MyFOO'
+storage['BAR'] = 'MyBar'
+PASS storage.length is 2
+PASS storage['FOO'] is "MyFOO"
+PASS storage['BAR'] is "MyBar"
+storage.clear()
+PASS storage.length is 0
+PASS storage['FOO'] is undefined
+PASS storage['BAR'] is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/domstorage/clear.html b/LayoutTests/storage/domstorage/clear.html
new file mode 100644
index 0000000..8f23701
--- /dev/null
+++ b/LayoutTests/storage/domstorage/clear.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/clear.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/complex-keys-expected.txt b/LayoutTests/storage/domstorage/complex-keys-expected.txt
new file mode 100644
index 0000000..4ff0d29
--- /dev/null
+++ b/LayoutTests/storage/domstorage/complex-keys-expected.txt
@@ -0,0 +1,237 @@
+Test dom storage with many different types of keys (as opposed to values)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS storage.getItem('FOO') is null
+storage.setItem('FOO', 'BAR')
+PASS storage.length is 1
+PASS storage.getItem('FOO') is "BAR"
+PASS storage.getItem('foo') is null
+PASS storage.foo is undefined.
+PASS storage['foo'] is undefined.
+storage.foo = 'x'
+PASS storage.foo is "x"
+PASS storage['foo'] is "x"
+PASS storage.getItem('foo') is "x"
+storage['foo'] = 'y'
+PASS storage.foo is "y"
+PASS storage['foo'] is "y"
+PASS storage.getItem('foo') is "y"
+storage.setItem('foo', 'z')
+PASS storage.foo is "z"
+PASS storage['foo'] is "z"
+PASS storage.getItem('foo') is "z"
+PASS storage.length is 2
+
+Testing a null key
+storage.setItem(null, 'asdf')
+PASS storage.getItem('null') is "asdf"
+PASS storage.getItem(null) is "asdf"
+PASS storage['null'] is "asdf"
+PASS storage[null] is "asdf"
+PASS storage.length is 3
+storage[null] = 1
+PASS storage.getItem(null) is "1"
+storage['null'] = 2
+PASS storage.getItem(null) is "2"
+storage.setItem('null', 3)
+PASS storage.getItem(null) is "3"
+PASS storage.length is 3
+
+Testing an undefined key
+storage[undefined] = 'xyz'
+PASS storage.getItem('undefined') is "xyz"
+PASS storage.getItem(undefined) is "xyz"
+PASS storage['undefined'] is "xyz"
+PASS storage[undefined] is "xyz"
+PASS storage.length is 4
+storage['undefined'] = 4
+PASS storage.getItem(undefined) is "4"
+storage.setItem(undefined, 5)
+PASS storage.getItem(undefined) is "5"
+storage.setItem('undefined', 6)
+PASS storage.getItem(undefined) is "6"
+PASS storage.length is 4
+
+Testing a numeric key
+storage['2'] = 'ppp'
+PASS storage.getItem('2') is "ppp"
+PASS storage.getItem(2) is "ppp"
+PASS storage['2'] is "ppp"
+PASS storage[2] is "ppp"
+PASS storage.length is 5
+storage[2] = 7
+PASS storage.getItem(2) is "7"
+storage.setItem(2, 8)
+PASS storage.getItem(2) is "8"
+storage.setItem('2', 9)
+PASS storage.getItem(2) is "9"
+PASS storage.length is 5
+
+Setting a non-ascii string to foo
+storage[k] = 'hello'
+PASS storage.getItem(k) is "hello"
+PASS storage[k] is "hello"
+PASS storage.length is 6
+
+Testing case differences
+storage.foo1 = 'lower1'
+storage.FOO1 = 'UPPER1'
+storage['foo2'] = 'lower2'
+storage['FOO2'] = 'UPPER2'
+storage.setItem('foo3', 'lower3')
+storage.setItem('FOO3', 'UPPER3')
+PASS storage.foo1 is "lower1"
+PASS storage.FOO1 is "UPPER1"
+PASS storage['foo2'] is "lower2"
+PASS storage['FOO2'] is "UPPER2"
+PASS storage.getItem('foo3') is "lower3"
+PASS storage.getItem('FOO3') is "UPPER3"
+PASS storage.length is 12
+
+Testing overriding length
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.length = 0
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage['length'] = 0
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.setItem('length', 0)
+PASS storage.length is 13
+PASS storage['length'] is 13
+PASS storage.getItem('length') is "0"
+storage.removeItem('length')
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.setItem('length', 0)
+PASS storage.length is 13
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS storage.getItem('FOO') is null
+storage.setItem('FOO', 'BAR')
+PASS storage.length is 1
+PASS storage.getItem('FOO') is "BAR"
+PASS storage.getItem('foo') is null
+PASS storage.foo is undefined.
+PASS storage['foo'] is undefined.
+storage.foo = 'x'
+PASS storage.foo is "x"
+PASS storage['foo'] is "x"
+PASS storage.getItem('foo') is "x"
+storage['foo'] = 'y'
+PASS storage.foo is "y"
+PASS storage['foo'] is "y"
+PASS storage.getItem('foo') is "y"
+storage.setItem('foo', 'z')
+PASS storage.foo is "z"
+PASS storage['foo'] is "z"
+PASS storage.getItem('foo') is "z"
+PASS storage.length is 2
+
+Testing a null key
+storage.setItem(null, 'asdf')
+PASS storage.getItem('null') is "asdf"
+PASS storage.getItem(null) is "asdf"
+PASS storage['null'] is "asdf"
+PASS storage[null] is "asdf"
+PASS storage.length is 3
+storage[null] = 1
+PASS storage.getItem(null) is "1"
+storage['null'] = 2
+PASS storage.getItem(null) is "2"
+storage.setItem('null', 3)
+PASS storage.getItem(null) is "3"
+PASS storage.length is 3
+
+Testing an undefined key
+storage[undefined] = 'xyz'
+PASS storage.getItem('undefined') is "xyz"
+PASS storage.getItem(undefined) is "xyz"
+PASS storage['undefined'] is "xyz"
+PASS storage[undefined] is "xyz"
+PASS storage.length is 4
+storage['undefined'] = 4
+PASS storage.getItem(undefined) is "4"
+storage.setItem(undefined, 5)
+PASS storage.getItem(undefined) is "5"
+storage.setItem('undefined', 6)
+PASS storage.getItem(undefined) is "6"
+PASS storage.length is 4
+
+Testing a numeric key
+storage['2'] = 'ppp'
+PASS storage.getItem('2') is "ppp"
+PASS storage.getItem(2) is "ppp"
+PASS storage['2'] is "ppp"
+PASS storage[2] is "ppp"
+PASS storage.length is 5
+storage[2] = 7
+PASS storage.getItem(2) is "7"
+storage.setItem(2, 8)
+PASS storage.getItem(2) is "8"
+storage.setItem('2', 9)
+PASS storage.getItem(2) is "9"
+PASS storage.length is 5
+
+Setting a non-ascii string to foo
+storage[k] = 'hello'
+PASS storage.getItem(k) is "hello"
+PASS storage[k] is "hello"
+PASS storage.length is 6
+
+Testing case differences
+storage.foo1 = 'lower1'
+storage.FOO1 = 'UPPER1'
+storage['foo2'] = 'lower2'
+storage['FOO2'] = 'UPPER2'
+storage.setItem('foo3', 'lower3')
+storage.setItem('FOO3', 'UPPER3')
+PASS storage.foo1 is "lower1"
+PASS storage.FOO1 is "UPPER1"
+PASS storage['foo2'] is "lower2"
+PASS storage['FOO2'] is "UPPER2"
+PASS storage.getItem('foo3') is "lower3"
+PASS storage.getItem('FOO3') is "UPPER3"
+PASS storage.length is 12
+
+Testing overriding length
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.length = 0
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage['length'] = 0
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.setItem('length', 0)
+PASS storage.length is 13
+PASS storage['length'] is 13
+PASS storage.getItem('length') is "0"
+storage.removeItem('length')
+PASS storage.length is 12
+PASS storage['length'] is 12
+PASS storage.getItem('length') is null
+storage.setItem('length', 0)
+PASS storage.length is 13
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/domstorage/complex-keys.html b/LayoutTests/storage/domstorage/complex-keys.html
new file mode 100644
index 0000000..40af774
--- /dev/null
+++ b/LayoutTests/storage/domstorage/complex-keys.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/complex-keys.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/complex-values-expected.txt b/LayoutTests/storage/domstorage/complex-values-expected.txt
new file mode 100644
index 0000000..69d7644
--- /dev/null
+++ b/LayoutTests/storage/domstorage/complex-values-expected.txt
@@ -0,0 +1,207 @@
+Test some corner case DOM Storage values.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS typeof storage['foo'] is "undefined"
+PASS storage['foo'] is undefined.
+PASS typeof storage.foo is "undefined"
+PASS storage.foo is undefined.
+PASS typeof storage.getItem('foo') is "object"
+PASS storage.getItem('foo') is null
+
+storage.foo1 = null
+PASS typeof storage['foo1'] is "string"
+PASS storage['foo1'] is "null"
+PASS typeof storage.foo1 is "string"
+PASS storage.foo1 is "null"
+PASS typeof storage.getItem('foo1') is "string"
+PASS storage.getItem('foo1') is "null"
+storage['foo2'] = null
+PASS typeof storage['foo2'] is "string"
+PASS storage['foo2'] is "null"
+PASS typeof storage.foo2 is "string"
+PASS storage.foo2 is "null"
+PASS typeof storage.getItem('foo2') is "string"
+PASS storage.getItem('foo2') is "null"
+storage.setItem('foo3', null)
+PASS typeof storage['foo3'] is "string"
+PASS storage['foo3'] is "null"
+PASS typeof storage.foo3 is "string"
+PASS storage.foo3 is "null"
+PASS typeof storage.getItem('foo3') is "string"
+PASS storage.getItem('foo3') is "null"
+
+storage.foo4 = undefined
+PASS typeof storage['foo4'] is "string"
+PASS storage['foo4'] is "undefined"
+PASS typeof storage.foo4 is "string"
+PASS storage.foo4 is "undefined"
+PASS typeof storage.getItem('foo4') is "string"
+PASS storage.getItem('foo4') is "undefined"
+storage['foo5'] = undefined
+PASS typeof storage['foo5'] is "string"
+PASS storage['foo5'] is "undefined"
+PASS typeof storage.foo5 is "string"
+PASS storage.foo5 is "undefined"
+PASS typeof storage.getItem('foo5') is "string"
+PASS storage.getItem('foo5') is "undefined"
+storage.setItem('foo6', undefined)
+PASS typeof storage['foo6'] is "string"
+PASS storage['foo6'] is "undefined"
+PASS typeof storage.foo6 is "string"
+PASS storage.foo6 is "undefined"
+PASS typeof storage.getItem('foo6') is "string"
+PASS storage.getItem('foo6') is "undefined"
+
+storage.foo7 = 2
+PASS typeof storage['foo7'] is "string"
+PASS storage['foo7'] is "2"
+PASS typeof storage.foo7 is "string"
+PASS storage.foo7 is "2"
+PASS typeof storage.getItem('foo7') is "string"
+PASS storage.getItem('foo7') is "2"
+storage['foo8'] = 2
+PASS typeof storage['foo8'] is "string"
+PASS storage['foo8'] is "2"
+PASS typeof storage.foo8 is "string"
+PASS storage.foo8 is "2"
+PASS typeof storage.getItem('foo8') is "string"
+PASS storage.getItem('foo8') is "2"
+storage.setItem('foo9', 2)
+PASS typeof storage['foo9'] is "string"
+PASS storage['foo9'] is "2"
+PASS typeof storage.foo9 is "string"
+PASS storage.foo9 is "2"
+PASS typeof storage.getItem('foo9') is "string"
+PASS storage.getItem('foo9') is "2"
+
+storage.foo10 = k
+PASS typeof storage['foo10'] is "string"
+PASS storage['foo10'] is "î—ÿ찡hello"
+PASS typeof storage.foo10 is "string"
+PASS storage.foo10 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo10') is "string"
+PASS storage.getItem('foo10') is "î—ÿ찡hello"
+storage['foo11'] = k
+PASS typeof storage['foo11'] is "string"
+PASS storage['foo11'] is "î—ÿ찡hello"
+PASS typeof storage.foo11 is "string"
+PASS storage.foo11 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo11') is "string"
+PASS storage.getItem('foo11') is "î—ÿ찡hello"
+storage.setItem('foo12', k)
+PASS typeof storage['foo12'] is "string"
+PASS storage['foo12'] is "î—ÿ찡hello"
+PASS typeof storage.foo12 is "string"
+PASS storage.foo12 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo12') is "string"
+PASS storage.getItem('foo12') is "î—ÿ찡hello"
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS typeof storage['foo'] is "undefined"
+PASS storage['foo'] is undefined.
+PASS typeof storage.foo is "undefined"
+PASS storage.foo is undefined.
+PASS typeof storage.getItem('foo') is "object"
+PASS storage.getItem('foo') is null
+
+storage.foo1 = null
+PASS typeof storage['foo1'] is "string"
+PASS storage['foo1'] is "null"
+PASS typeof storage.foo1 is "string"
+PASS storage.foo1 is "null"
+PASS typeof storage.getItem('foo1') is "string"
+PASS storage.getItem('foo1') is "null"
+storage['foo2'] = null
+PASS typeof storage['foo2'] is "string"
+PASS storage['foo2'] is "null"
+PASS typeof storage.foo2 is "string"
+PASS storage.foo2 is "null"
+PASS typeof storage.getItem('foo2') is "string"
+PASS storage.getItem('foo2') is "null"
+storage.setItem('foo3', null)
+PASS typeof storage['foo3'] is "string"
+PASS storage['foo3'] is "null"
+PASS typeof storage.foo3 is "string"
+PASS storage.foo3 is "null"
+PASS typeof storage.getItem('foo3') is "string"
+PASS storage.getItem('foo3') is "null"
+
+storage.foo4 = undefined
+PASS typeof storage['foo4'] is "string"
+PASS storage['foo4'] is "undefined"
+PASS typeof storage.foo4 is "string"
+PASS storage.foo4 is "undefined"
+PASS typeof storage.getItem('foo4') is "string"
+PASS storage.getItem('foo4') is "undefined"
+storage['foo5'] = undefined
+PASS typeof storage['foo5'] is "string"
+PASS storage['foo5'] is "undefined"
+PASS typeof storage.foo5 is "string"
+PASS storage.foo5 is "undefined"
+PASS typeof storage.getItem('foo5') is "string"
+PASS storage.getItem('foo5') is "undefined"
+storage.setItem('foo6', undefined)
+PASS typeof storage['foo6'] is "string"
+PASS storage['foo6'] is "undefined"
+PASS typeof storage.foo6 is "string"
+PASS storage.foo6 is "undefined"
+PASS typeof storage.getItem('foo6') is "string"
+PASS storage.getItem('foo6') is "undefined"
+
+storage.foo7 = 2
+PASS typeof storage['foo7'] is "string"
+PASS storage['foo7'] is "2"
+PASS typeof storage.foo7 is "string"
+PASS storage.foo7 is "2"
+PASS typeof storage.getItem('foo7') is "string"
+PASS storage.getItem('foo7') is "2"
+storage['foo8'] = 2
+PASS typeof storage['foo8'] is "string"
+PASS storage['foo8'] is "2"
+PASS typeof storage.foo8 is "string"
+PASS storage.foo8 is "2"
+PASS typeof storage.getItem('foo8') is "string"
+PASS storage.getItem('foo8') is "2"
+storage.setItem('foo9', 2)
+PASS typeof storage['foo9'] is "string"
+PASS storage['foo9'] is "2"
+PASS typeof storage.foo9 is "string"
+PASS storage.foo9 is "2"
+PASS typeof storage.getItem('foo9') is "string"
+PASS storage.getItem('foo9') is "2"
+
+storage.foo10 = k
+PASS typeof storage['foo10'] is "string"
+PASS storage['foo10'] is "î—ÿ찡hello"
+PASS typeof storage.foo10 is "string"
+PASS storage.foo10 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo10') is "string"
+PASS storage.getItem('foo10') is "î—ÿ찡hello"
+storage['foo11'] = k
+PASS typeof storage['foo11'] is "string"
+PASS storage['foo11'] is "î—ÿ찡hello"
+PASS typeof storage.foo11 is "string"
+PASS storage.foo11 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo11') is "string"
+PASS storage.getItem('foo11') is "î—ÿ찡hello"
+storage.setItem('foo12', k)
+PASS typeof storage['foo12'] is "string"
+PASS storage['foo12'] is "î—ÿ찡hello"
+PASS typeof storage.foo12 is "string"
+PASS storage.foo12 is "î—ÿ찡hello"
+PASS typeof storage.getItem('foo12') is "string"
+PASS storage.getItem('foo12') is "î—ÿ찡hello"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/domstorage/complex-values.html b/LayoutTests/storage/domstorage/complex-values.html
new file mode 100644
index 0000000..00ad8d7
--- /dev/null
+++ b/LayoutTests/storage/domstorage/complex-values.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/complex-values.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/basic-body-attribute-expected.txt b/LayoutTests/storage/domstorage/events/basic-body-attribute-expected.txt
new file mode 100644
index 0000000..273c95b
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic-body-attribute-expected.txt
@@ -0,0 +1,102 @@
+This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener specified as an attribute on the body.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+iframe.onload = step1
+iframe.src = 'resources/body-event-handler.html'
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+iframe.onload = step1
+iframe.src = 'resources/body-event-handler.html'
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/storage/domstorage/events/basic-body-attribute.html b/LayoutTests/storage/domstorage/events/basic-body-attribute.html
new file mode 100644
index 0000000..c2778ff
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic-body-attribute.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="script-tests/basic-body-attribute.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/basic-expected.txt b/LayoutTests/storage/domstorage/events/basic-expected.txt
new file mode 100644
index 0000000..bccdb5c
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic-expected.txt
@@ -0,0 +1,98 @@
+This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener set via window.onstorage.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt b/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt
new file mode 100644
index 0000000..99c7f18
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic-setattribute-expected.txt
@@ -0,0 +1,102 @@
+This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener attached via setattribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+iframe.onload = step1
+iframe.src = 'resources/setattribute-event-handler.html'
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+iframe.onload = step1
+iframe.src = 'resources/setattribute-event-handler.html'
+Reset storage event list
+storageEventList = new Array()
+storage.setItem('FOO', 'BAR')
+PASS storageEventList.length is 1
+PASS storageEventList[0].key is "FOO"
+PASS storageEventList[0].oldValue is null
+PASS storageEventList[0].newValue is "BAR"
+storage.setItem('FU', 'BAR')
+storage.setItem('a', '1')
+storage.setItem('b', '2')
+storage.setItem('b', '3')
+PASS storageEventList.length is 5
+PASS storageEventList[1].key is "FU"
+PASS storageEventList[1].oldValue is null
+PASS storageEventList[1].newValue is "BAR"
+PASS storageEventList[2].key is "a"
+PASS storageEventList[2].oldValue is null
+PASS storageEventList[2].newValue is "1"
+PASS storageEventList[3].key is "b"
+PASS storageEventList[3].oldValue is null
+PASS storageEventList[3].newValue is "2"
+PASS storageEventList[4].key is "b"
+PASS storageEventList[4].oldValue is "2"
+PASS storageEventList[4].newValue is "3"
+storage.removeItem('FOO')
+PASS storageEventList.length is 6
+PASS storageEventList[5].key is "FOO"
+PASS storageEventList[5].oldValue is "BAR"
+PASS storageEventList[5].newValue is null
+storage.removeItem('FU')
+PASS storageEventList.length is 7
+PASS storageEventList[6].key is "FU"
+PASS storageEventList[6].oldValue is "BAR"
+PASS storageEventList[6].newValue is null
+storage.clear()
+PASS storageEventList.length is 8
+PASS storageEventList[7].key is null
+PASS storageEventList[7].oldValue is null
+PASS storageEventList[7].newValue is null
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/storage/domstorage/events/basic-setattribute.html b/LayoutTests/storage/domstorage/events/basic-setattribute.html
new file mode 100644
index 0000000..2b95568
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic-setattribute.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="script-tests/basic-setattribute.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/basic.html b/LayoutTests/storage/domstorage/events/basic.html
new file mode 100644
index 0000000..4c52d07
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/basic.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="script-tests/basic.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/case-sensitive-expected.txt b/LayoutTests/storage/domstorage/events/case-sensitive-expected.txt
new file mode 100644
index 0000000..6cdf19f
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/case-sensitive-expected.txt
@@ -0,0 +1,38 @@
+Verify that storage events fire even when only the case of the value changes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+
+Verify storage events are case sensitive
+storage.foo = 'test'
+Reset storage event list
+storageEventList = new Array()
+storage.foo = 'test'
+PASS storageEventList.length is 0
+storage.foo = 'TEST'
+PASS storageEventList.length is 1
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+
+Verify storage events are case sensitive
+storage.foo = 'test'
+Reset storage event list
+storageEventList = new Array()
+storage.foo = 'test'
+PASS storageEventList.length is 0
+storage.foo = 'TEST'
+PASS storageEventList.length is 1
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/storage/domstorage/events/case-sensitive.html b/LayoutTests/storage/domstorage/events/case-sensitive.html
new file mode 100644
index 0000000..c8da433
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/case-sensitive.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="script-tests/case-sensitive.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/documentURI-expected.txt b/LayoutTests/storage/domstorage/events/documentURI-expected.txt
new file mode 100644
index 0000000..5952523
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/documentURI-expected.txt
@@ -0,0 +1,40 @@
+Test that changing documentURI has no effects on the uri passed into storage events.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+Reset storage event list
+storageEventList = new Array()
+storage.foo = '123'
+PASS storageEventList.length is 1
+Saving URI
+document.documentURI = 'abc'
+PASS document.documentURI is "abc"
+storage.foo = 'xyz'
+PASS storageEventList.length is 2
+PASS true is true
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+Reset storage event list
+storageEventList = new Array()
+storage.foo = '123'
+PASS storageEventList.length is 1
+Saving URI
+document.documentURI = 'abc'
+PASS document.documentURI is "abc"
+storage.foo = 'xyz'
+PASS storageEventList.length is 2
+PASS true is true
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
diff --git a/LayoutTests/storage/domstorage/events/documentURI.html b/LayoutTests/storage/domstorage/events/documentURI.html
new file mode 100644
index 0000000..7721e87
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/documentURI.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="script-tests/documentURI.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/resources/body-event-handler.html b/LayoutTests/storage/domstorage/events/resources/body-event-handler.html
new file mode 100644
index 0000000..a1218fe
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/body-event-handler.html
@@ -0,0 +1,8 @@
+<html><head><script>
+
+function handleStorageEvent(e) {
+ window.parent.storageEventList.push(e);
+}
+
+</script></head><body onstorage="handleStorageEvent(window.event);">
+</body></html>
diff --git a/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js b/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js
new file mode 100644
index 0000000..8f15c31
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js
@@ -0,0 +1,51 @@
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+iframe = document.createElement("IFRAME");
+iframe.src = "about:blank";
+document.body.appendChild(iframe);
+iframe.contentWindow.document.body.innerText = "Nothing to see here.";
+
+storageEventList = new Array();
+iframe.contentWindow.onstorage = function (e) {
+ window.parent.storageEventList.push(e);
+}
+
+function runAfterStorageEvents(callback) {
+ var currentCount = storageEventList.length;
+ function onTimeout() {
+ if (currentCount != storageEventList.length)
+ runAfterStorageEvents(callback);
+ else
+ callback();
+ }
+ setTimeout(onTimeout, 0);
+}
+
+function testStorages(testCallback)
+{
+ // When we're done testing LocalStorage, this is run.
+ function allDone()
+ {
+ debug("");
+ debug("");
+ window.successfullyParsed = true;
+ isSuccessfullyParsed();
+ debug("");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+ }
+
+ // When we're done testing with SessionStorage, this is run.
+ function runLocalStorage()
+ {
+ debug("");
+ debug("");
+ testCallback("localStorage", allDone);
+ }
+
+ // First run the test with SessionStorage.
+ testCallback("sessionStorage", runLocalStorage);
+}
diff --git a/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html b/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html
new file mode 100644
index 0000000..a764c53
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html
@@ -0,0 +1,11 @@
+<html><head></head><body>
+<script>
+
+function handleStorageEvent(e) {
+ window.parent.storageEventList.push(e);
+}
+
+document.body.setAttribute("onstorage", "handleStorageEvent(window.event);");
+
+</script>
+</body></html>
diff --git a/LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html b/LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html
new file mode 100644
index 0000000..d9af438
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/eventTestHarness.js"></script>
+<script src="YOUR_JS_FILE_HERE"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/events/script-tests/basic-body-attribute.js b/LayoutTests/storage/domstorage/events/script-tests/basic-body-attribute.js
new file mode 100644
index 0000000..7054069
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/basic-body-attribute.js
@@ -0,0 +1,98 @@
+description("This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener specified as an attribute on the body.");
+
+function test(storageString, callback)
+{
+ window.completionCallback = callback;
+ window.storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ evalAndLog("iframe.onload = step1");
+ evalAndLog("iframe.src = 'resources/body-event-handler.html'");
+}
+
+function step1()
+{
+ debug("Reset storage event list");
+ evalAndLog("storageEventList = new Array()");
+ evalAndLog("storage.setItem('FOO', 'BAR')");
+
+ runAfterStorageEvents(step2);
+}
+
+function step2()
+{
+ shouldBe("storageEventList.length", "1");
+ shouldBeEqualToString("storageEventList[0].key", "FOO");
+ shouldBeNull("storageEventList[0].oldValue");
+ shouldBeEqualToString("storageEventList[0].newValue", "BAR");
+ evalAndLog("storage.setItem('FU', 'BAR')");
+ evalAndLog("storage.setItem('a', '1')");
+ evalAndLog("storage.setItem('b', '2')");
+ evalAndLog("storage.setItem('b', '3')");
+
+ runAfterStorageEvents(step3);
+}
+
+function step3()
+{
+ shouldBe("storageEventList.length", "5");
+ shouldBeEqualToString("storageEventList[1].key", "FU");
+ shouldBeNull("storageEventList[1].oldValue");
+ shouldBeEqualToString("storageEventList[1].newValue", "BAR");
+ shouldBeEqualToString("storageEventList[2].key", "a");
+ shouldBeNull("storageEventList[2].oldValue");
+ shouldBeEqualToString("storageEventList[2].newValue", "1");
+ shouldBeEqualToString("storageEventList[3].key", "b");
+ shouldBeNull("storageEventList[3].oldValue");
+ shouldBeEqualToString("storageEventList[3].newValue", "2");
+ shouldBeEqualToString("storageEventList[4].key", "b");
+ shouldBeEqualToString("storageEventList[4].oldValue", "2");
+ shouldBeEqualToString("storageEventList[4].newValue", "3");
+ evalAndLog("storage.removeItem('FOO')");
+
+ runAfterStorageEvents(step4);
+}
+
+function step4()
+{
+ shouldBe("storageEventList.length", "6");
+ shouldBeEqualToString("storageEventList[5].key", "FOO");
+ shouldBeEqualToString("storageEventList[5].oldValue", "BAR");
+ shouldBeNull("storageEventList[5].newValue");
+ evalAndLog("storage.removeItem('FU')");
+
+ runAfterStorageEvents(step5);
+}
+
+function step5()
+{
+ shouldBe("storageEventList.length", "7");
+ shouldBeEqualToString("storageEventList[6].key", "FU");
+ shouldBeEqualToString("storageEventList[6].oldValue", "BAR");
+ shouldBeNull("storageEventList[6].newValue");
+ evalAndLog("storage.clear()");
+
+ runAfterStorageEvents(step6);
+}
+
+function step6()
+{
+ shouldBe("storageEventList.length", "8");
+ shouldBeNull("storageEventList[7].key");
+ shouldBeNull("storageEventList[7].oldValue");
+ shouldBeNull("storageEventList[7].newValue");
+
+ completionCallback();
+}
+
+testStorages(test);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js b/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js
new file mode 100644
index 0000000..0da34a6
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/basic-setattribute.js
@@ -0,0 +1,98 @@
+description("This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener attached via setattribute.");
+
+function test(storageString, callback)
+{
+ window.completionCallback = callback;
+ window.storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ evalAndLog("iframe.onload = step1");
+ evalAndLog("iframe.src = 'resources/setattribute-event-handler.html'");
+}
+
+function step1()
+{
+ debug("Reset storage event list");
+ evalAndLog("storageEventList = new Array()");
+ evalAndLog("storage.setItem('FOO', 'BAR')");
+
+ runAfterStorageEvents(step2);
+}
+
+function step2()
+{
+ shouldBe("storageEventList.length", "1");
+ shouldBeEqualToString("storageEventList[0].key", "FOO");
+ shouldBeNull("storageEventList[0].oldValue");
+ shouldBeEqualToString("storageEventList[0].newValue", "BAR");
+ evalAndLog("storage.setItem('FU', 'BAR')");
+ evalAndLog("storage.setItem('a', '1')");
+ evalAndLog("storage.setItem('b', '2')");
+ evalAndLog("storage.setItem('b', '3')");
+
+ runAfterStorageEvents(step3);
+}
+
+function step3()
+{
+ shouldBe("storageEventList.length", "5");
+ shouldBeEqualToString("storageEventList[1].key", "FU");
+ shouldBeNull("storageEventList[1].oldValue");
+ shouldBeEqualToString("storageEventList[1].newValue", "BAR");
+ shouldBeEqualToString("storageEventList[2].key", "a");
+ shouldBeNull("storageEventList[2].oldValue");
+ shouldBeEqualToString("storageEventList[2].newValue", "1");
+ shouldBeEqualToString("storageEventList[3].key", "b");
+ shouldBeNull("storageEventList[3].oldValue");
+ shouldBeEqualToString("storageEventList[3].newValue", "2");
+ shouldBeEqualToString("storageEventList[4].key", "b");
+ shouldBeEqualToString("storageEventList[4].oldValue", "2");
+ shouldBeEqualToString("storageEventList[4].newValue", "3");
+ evalAndLog("storage.removeItem('FOO')");
+
+ runAfterStorageEvents(step4);
+}
+
+function step4()
+{
+ shouldBe("storageEventList.length", "6");
+ shouldBeEqualToString("storageEventList[5].key", "FOO");
+ shouldBeEqualToString("storageEventList[5].oldValue", "BAR");
+ shouldBeNull("storageEventList[5].newValue");
+ evalAndLog("storage.removeItem('FU')");
+
+ runAfterStorageEvents(step5);
+}
+
+function step5()
+{
+ shouldBe("storageEventList.length", "7");
+ shouldBeEqualToString("storageEventList[6].key", "FU");
+ shouldBeEqualToString("storageEventList[6].oldValue", "BAR");
+ shouldBeNull("storageEventList[6].newValue");
+ evalAndLog("storage.clear()");
+
+ runAfterStorageEvents(step6);
+}
+
+function step6()
+{
+ shouldBe("storageEventList.length", "8");
+ shouldBeNull("storageEventList[7].key");
+ shouldBeNull("storageEventList[7].oldValue");
+ shouldBeNull("storageEventList[7].newValue");
+
+ completionCallback();
+}
+
+testStorages(test);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/domstorage/events/script-tests/basic.js b/LayoutTests/storage/domstorage/events/script-tests/basic.js
new file mode 100644
index 0000000..06591b1
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/basic.js
@@ -0,0 +1,97 @@
+description("This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener set via window.onstorage.");
+
+function test(storageString, callback)
+{
+ window.completionCallback = callback;
+ window.storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ runAfterStorageEvents(step1);
+}
+
+function step1()
+{
+ debug("Reset storage event list");
+ evalAndLog("storageEventList = new Array()");
+ evalAndLog("storage.setItem('FOO', 'BAR')");
+
+ runAfterStorageEvents(step2);
+}
+
+function step2()
+{
+ shouldBe("storageEventList.length", "1");
+ shouldBeEqualToString("storageEventList[0].key", "FOO");
+ shouldBeNull("storageEventList[0].oldValue");
+ shouldBeEqualToString("storageEventList[0].newValue", "BAR");
+ evalAndLog("storage.setItem('FU', 'BAR')");
+ evalAndLog("storage.setItem('a', '1')");
+ evalAndLog("storage.setItem('b', '2')");
+ evalAndLog("storage.setItem('b', '3')");
+
+ runAfterStorageEvents(step3);
+}
+
+function step3()
+{
+ shouldBe("storageEventList.length", "5");
+ shouldBeEqualToString("storageEventList[1].key", "FU");
+ shouldBeNull("storageEventList[1].oldValue");
+ shouldBeEqualToString("storageEventList[1].newValue", "BAR");
+ shouldBeEqualToString("storageEventList[2].key", "a");
+ shouldBeNull("storageEventList[2].oldValue");
+ shouldBeEqualToString("storageEventList[2].newValue", "1");
+ shouldBeEqualToString("storageEventList[3].key", "b");
+ shouldBeNull("storageEventList[3].oldValue");
+ shouldBeEqualToString("storageEventList[3].newValue", "2");
+ shouldBeEqualToString("storageEventList[4].key", "b");
+ shouldBeEqualToString("storageEventList[4].oldValue", "2");
+ shouldBeEqualToString("storageEventList[4].newValue", "3");
+ evalAndLog("storage.removeItem('FOO')");
+
+ runAfterStorageEvents(step4);
+}
+
+function step4()
+{
+ shouldBe("storageEventList.length", "6");
+ shouldBeEqualToString("storageEventList[5].key", "FOO");
+ shouldBeEqualToString("storageEventList[5].oldValue", "BAR");
+ shouldBeNull("storageEventList[5].newValue");
+ evalAndLog("storage.removeItem('FU')");
+
+ runAfterStorageEvents(step5);
+}
+
+function step5()
+{
+ shouldBe("storageEventList.length", "7");
+ shouldBeEqualToString("storageEventList[6].key", "FU");
+ shouldBeEqualToString("storageEventList[6].oldValue", "BAR");
+ shouldBeNull("storageEventList[6].newValue");
+ evalAndLog("storage.clear()");
+
+ runAfterStorageEvents(step6);
+}
+
+function step6()
+{
+ shouldBe("storageEventList.length", "8");
+ shouldBeNull("storageEventList[7].key");
+ shouldBeNull("storageEventList[7].oldValue");
+ shouldBeNull("storageEventList[7].newValue");
+
+ completionCallback();
+}
+
+testStorages(test);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/domstorage/events/script-tests/case-sensitive.js b/LayoutTests/storage/domstorage/events/script-tests/case-sensitive.js
new file mode 100644
index 0000000..b5038a8
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/case-sensitive.js
@@ -0,0 +1,50 @@
+description("Verify that storage events fire even when only the case of the value changes.");
+
+function test(storageString, callback)
+{
+ window.completionCallback = callback;
+ window.storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("");
+ debug("Verify storage events are case sensitive");
+ evalAndLog("storage.foo = 'test'");
+
+ runAfterStorageEvents(step1);
+}
+
+function step1()
+{
+ debug("Reset storage event list");
+ evalAndLog("storageEventList = new Array()");
+ evalAndLog("storage.foo = 'test'");
+
+ runAfterStorageEvents(step2);
+}
+
+function step2()
+{
+ shouldBe("storageEventList.length", "0");
+ evalAndLog("storage.foo = 'TEST'");
+
+ runAfterStorageEvents(step3);
+}
+
+function step3()
+{
+ shouldBe("storageEventList.length", "1");
+
+ completionCallback();
+}
+
+testStorages(test);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/domstorage/events/script-tests/documentURI.js b/LayoutTests/storage/domstorage/events/script-tests/documentURI.js
new file mode 100644
index 0000000..4b4f4cb
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/script-tests/documentURI.js
@@ -0,0 +1,52 @@
+description("Test that changing documentURI has no effects on the uri passed into storage events.");
+
+function test(storageString, callback)
+{
+ window.completionCallback = callback;
+ window.storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ runAfterStorageEvents(step1);
+}
+
+function step1()
+{
+ debug("Reset storage event list");
+ evalAndLog("storageEventList = new Array()");
+ evalAndLog("storage.foo = '123'");
+
+ runAfterStorageEvents(step2);
+}
+
+function step2()
+{
+ shouldBe("storageEventList.length", "1");
+ debug("Saving URI");
+ window.lastURI = storageEventList[0].uri;
+
+ evalAndLog("document.documentURI = 'abc'");
+ shouldBeEqualToString("document.documentURI", "abc");
+ evalAndLog("storage.foo = 'xyz'");
+
+ runAfterStorageEvents(step3);
+}
+
+function step3()
+{
+ shouldBe("storageEventList.length", "2");
+ shouldBeTrue(String(window.lastURI == storageEventList[1].uri));
+
+ completionCallback();
+}
+
+testStorages(test);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/storage/domstorage/localstorage/delete-removal-expected.txt b/LayoutTests/storage/domstorage/localstorage/delete-removal-expected.txt
new file mode 100644
index 0000000..b50b617
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/delete-removal-expected.txt
@@ -0,0 +1,13 @@
+This test makes sure that using the syntax `delete localStorage.keyName` works as an alias to `localStorage.removeItem(keyName).`
+foo (before anything) is: undefined
+foo (after a named property settter set) is: bar
+foo (after a delete) is: undefined
+foo (after an indexed setter set) is: bar
+foo (after deleting FOO (not foo)) is: bar
+foo (after a delete) is: undefined
+foo (after calling setItem) is: bar
+foo (after a delete) is: undefined
+foo (after a redundant delete) is: undefined
+foo (after an implicit settter set) is: bar
+foo (after an indexed delete) is: undefined
+
diff --git a/LayoutTests/storage/domstorage/localstorage/delete-removal.html b/LayoutTests/storage/domstorage/localstorage/delete-removal.html
new file mode 100644
index 0000000..85d1278
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/delete-removal.html
@@ -0,0 +1,51 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById('logger').appendChild(document.createTextNode(a));
+ document.getElementById('logger').appendChild(document.createElement("br"));
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ log("foo (before anything) is: " + localStorage.foo);
+ localStorage.foo = "bar";
+ log("foo (after a named property settter set) is: " + localStorage.foo);
+ delete localStorage.foo;
+ log("foo (after a delete) is: " + localStorage.foo);
+ localStorage["foo"] = "bar";
+ log("foo (after an indexed setter set) is: " + localStorage.foo);
+ delete localStorage.FOO;
+ log("foo (after deleting FOO (not foo)) is: " + localStorage.foo);
+ delete localStorage.foo;
+ log("foo (after a delete) is: " + localStorage.foo);
+ localStorage.setItem("foo", "bar");
+ log("foo (after calling setItem) is: " + localStorage.foo);
+ delete localStorage.foo;
+ log("foo (after a delete) is: " + localStorage.foo);
+ delete localStorage.foo;
+ log("foo (after a redundant delete) is: " + localStorage.foo);
+ localStorage.foo = "bar";
+ log("foo (after an implicit settter set) is: " + localStorage.foo);
+ delete localStorage["foo"];
+ log("foo (after an indexed delete) is: " + localStorage.foo);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test makes sure that using the syntax `delete localStorage.keyName` works as an alias to `localStorage.removeItem(keyName).`<br><hr>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/enumerate-storage-expected.txt b/LayoutTests/storage/domstorage/localstorage/enumerate-storage-expected.txt
new file mode 100644
index 0000000..a9feac5
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/enumerate-storage-expected.txt
@@ -0,0 +1,9 @@
+This test checks to see that you can enumerate a Storage object and get only the keys as a result. The built-in properties of the Storage object should be ignored. The test operates on the localStorage object.
+alpha
+bar
+batman
+foo
+fu
+prototypeTestKey
+zeta
+
diff --git a/LayoutTests/storage/domstorage/localstorage/enumerate-storage.html b/LayoutTests/storage/domstorage/localstorage/enumerate-storage.html
new file mode 100644
index 0000000..b45a419
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/enumerate-storage.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function startTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ Storage.prototype.prototypeTestKey = "prototypeTestValue";
+ localStorage.foo = "bar";
+ localStorage.fu = "baz";
+ localStorage.batman = "bin suparman";
+ localStorage.bar = "foo";
+ localStorage.alpha = "beta";
+ localStorage.zeta = "gamma";
+
+ // Enumerate localStorage, appending each key onto an array
+ var enumeratedArray = new Array();
+ for (var n in localStorage)
+ enumeratedArray.push(n);
+
+ // Sort the array, since the storage order isn't guaranteed
+ enumeratedArray.sort();
+
+ for (var n in enumeratedArray)
+ log(enumeratedArray[n]);
+}
+
+</script>
+</head>
+<body onload="startTest();">
+This test checks to see that you can enumerate a Storage object and get only the keys as a result. The built-in properties of the Storage object should be ignored. The test operates on the localStorage object.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key-expected.txt b/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key-expected.txt
new file mode 100644
index 0000000..7b61676
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key-expected.txt
@@ -0,0 +1,8 @@
+This test attempts to enumerate all the keys in localStorage with .length + .key(). The built-in properties of the Storage object should be ignored. The test operates on the localStorage object.
+alpha
+bar
+batman
+foo
+fu
+zeta
+
diff --git a/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key.html b/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key.html
new file mode 100644
index 0000000..aa77dcd
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/enumerate-with-length-and-key.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function startTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ Storage.prototype.prototypeTestKey = "prototypeTestValue";
+ localStorage.foo = "bar";
+ localStorage.fu = "baz";
+ localStorage.batman = "bin suparman";
+ localStorage.bar = "foo";
+ localStorage.alpha = "beta";
+ localStorage.zeta = "gamma";
+
+ // Enumerate localStorage, appending each key onto an array
+ var enumeratedArray = new Array();
+ for (var i=0; i<localStorage.length; ++i)
+ enumeratedArray.push(localStorage.key(i));
+
+ // Sort the array, since the storage order isn't guaranteed
+ enumeratedArray.sort();
+
+ for (var n in enumeratedArray)
+ log(enumeratedArray[n]);
+}
+
+</script>
+</head>
+<body onload="startTest();">
+This test attempts to enumerate all the keys in localStorage with .length + .key(). The built-in properties of the Storage object should be ignored. The test operates on the localStorage object.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt b/LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt
new file mode 100644
index 0000000..ad58023
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt
@@ -0,0 +1,32 @@
+This is a test to make sure you can get and set values in localStorage by index.
+Setting FOO using the index setter.
+Reading FOO:
+BAR
+BAR
+BAR
+
+Setting FOO again, using setItem.
+Reading FOO:
+BAZ
+BAZ
+BAZ
+
+Setting FOO again, using the index setter.
+Reading FOO:
+BAT
+BAT
+BAT
+
+Setting FOO again, using property-slot syntax
+Reading FOO:
+BATMAN
+BATMAN
+BATMAN
+
+Removing FOO, then trying to read it
+Reading FOO:
+undefined
+undefined
+null
+
+
diff --git a/LayoutTests/storage/domstorage/localstorage/index-get-and-set.html b/LayoutTests/storage/domstorage/localstorage/index-get-and-set.html
new file mode 100644
index 0000000..1026f51
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/index-get-and-set.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function finish()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ finish();
+ return;
+ }
+
+ log("Setting FOO using the index setter.");
+ localStorage["FOO"] = "BAR";
+ log("Reading FOO:");
+ log(localStorage.FOO);
+ log(localStorage["FOO"]);
+ log(localStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using setItem.");
+ localStorage.setItem("FOO", "BAZ");
+ log("Reading FOO:");
+ log(localStorage.FOO);
+ log(localStorage["FOO"]);
+ log(localStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using the index setter.");
+ localStorage["FOO"] = "BAT";
+ log("Reading FOO:");
+ log(localStorage.FOO);
+ log(localStorage["FOO"]);
+ log(localStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using property-slot syntax");
+ localStorage.FOO = "BATMAN";
+ log("Reading FOO:");
+ log(localStorage.FOO);
+ log(localStorage["FOO"]);
+ log(localStorage.getItem("FOO"));
+ log("");
+
+ log("Removing FOO, then trying to read it");
+ localStorage.removeItem("FOO");
+ log("Reading FOO:");
+ log(localStorage.FOO);
+ log(localStorage["FOO"]);
+ log(localStorage.getItem("FOO"));
+ log("");
+
+ finish();
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a test to make sure you can get and set values in localStorage by index.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt
new file mode 100644
index 0000000..6de4296
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage-expected.txt
@@ -0,0 +1,7 @@
+This is a test to make sure that when private browsing is on any attempt to change the localStorage area fail.
+Initial value of testItem is: InitialValue
+Caught exception trying to change item: Error: QUOTA_EXCEEDED_ERR: DOM Exception 22
+After change attempt, testItem is: InitialValue
+After remove attempt, testItem is: InitialValue
+After clear attempt, testItem is: InitialValue
+
diff --git a/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage.html b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage.html
new file mode 100644
index 0000000..9e46bec
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/private-browsing-affects-storage.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+ if (!window.layoutTestController) {
+ log("Test only designed to be run under DumpRenderTree");
+ return;
+ }
+
+ localStorage.setItem("testItem", "InitialValue");
+ layoutTestController.setPrivateBrowsingEnabled(true);
+ log("Initial value of testItem is: " + localStorage.getItem("testItem"));
+
+ try {
+ localStorage.setItem("testItem", "ChangedValue");
+ } catch(e) {
+ log("Caught exception trying to change item: " + e);
+ }
+
+ log("After change attempt, testItem is: " + localStorage.getItem("testItem"));
+
+ localStorage.removeItem("testItem");
+ log("After remove attempt, testItem is: " + localStorage.getItem("testItem"));
+
+ localStorage.clear();
+ log("After clear attempt, testItem is: " + localStorage.getItem("testItem"));
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a test to make sure that when private browsing is on any attempt to change the localStorage area fail.
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js b/LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js
new file mode 100644
index 0000000..418d000
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js
@@ -0,0 +1,12 @@
+function clearLocalStorage()
+{
+ var keys = new Array();
+ for (key in localStorage)
+ keys.push(key);
+
+ for (key in keys)
+ localStorage.removeItem(keys[key]);
+}
+
+if (window.localStorage)
+ clearLocalStorage();
diff --git a/LayoutTests/storage/domstorage/localstorage/resources/iframe-events-second.html b/LayoutTests/storage/domstorage/localstorage/resources/iframe-events-second.html
new file mode 100644
index 0000000..2ab8ba1
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/resources/iframe-events-second.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+function handleStorageEvent(e)
+{
+ parent.log("Subframe received storage event:");
+ parent.log("Key - " + e.key);
+ parent.log("New Value - " + e.newValue);
+ parent.log("Old Value - " + e.oldValue);
+ parent.log("URI - " + parent.normalizeURL(e.uri));
+ parent.log("Storage Area - " + ((e.storageArea == window.localStorage) ? "This window's window.localStorage" : "Another window's window.localStorage"));
+ parent.log("");
+
+ if (e.key != "Subframe") {
+ parent.log("Subframe about to change localStorage...");
+ localStorage.setItem("Subframe", "SET");
+ }
+}
+</script>
+</head>
+<body onload="window.addEventListener('storage', handleStorageEvent, false);">
+This is the subframe which exists to make sure that both frames of a same security origin receive the event for that origin's localStorage object mutating
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/resources/window-open-second.html b/LayoutTests/storage/domstorage/localstorage/resources/window-open-second.html
new file mode 100644
index 0000000..f944d71
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/resources/window-open-second.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script>
+
+var secondWindowLog = "Logging from second window:<br>";
+
+function log(a)
+{
+ secondWindowLog += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ log("Value for FOO is " + window.localStorage.getItem("FOO"));
+ window.localStorage.setItem("FOO", "BAR-NEWWINDOW");
+ log("Value for FOO after changing my own copy is " + window.localStorage.getItem("FOO"));
+
+ log("Value for FOO in my opening window is " + window.opener.localStorage.getItem("FOO"));
+
+ window.opener.log(secondWindowLog);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a new window to make sure the localStorage object for an origin is shared between multiple windows.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/simple-usage-expected.txt b/LayoutTests/storage/domstorage/localstorage/simple-usage-expected.txt
new file mode 100644
index 0000000..8a318c8
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/simple-usage-expected.txt
@@ -0,0 +1,13 @@
+This test tries simple operations on localStorage
+Length is 0
+Value for FOO is null
+Length is 1
+Value for FOO is BAR
+Key for index 0 is FOO
+Key for index 1 is null
+Key for index -1 is null
+Length is 1
+Value for FOO is BAZ
+Length is 0
+Value for FOO is null
+
diff --git a/LayoutTests/storage/domstorage/localstorage/simple-usage.html b/LayoutTests/storage/domstorage/localstorage/simple-usage.html
new file mode 100644
index 0000000..37592d0
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/simple-usage.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+
+ localStorage.setItem("FOO", "BAR");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+ log("Key for index 0 is " + localStorage.key(0));
+ log("Key for index 1 is " + localStorage.key(1));
+ log("Key for index -1 is " + localStorage.key(-1));
+
+ localStorage.setItem("FOO", "BAZ");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+
+ localStorage.removeItem("FOO");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test tries simple operations on localStorage<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt b/LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt
new file mode 100644
index 0000000..81ca1fa
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/string-conversion-expected.txt
@@ -0,0 +1,15 @@
+This test case verifies that local storage only stores strings.
+Length is 0
+Testing implicit setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+Testing explicit setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+Testing index setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+
diff --git a/LayoutTests/storage/domstorage/localstorage/string-conversion.html b/LayoutTests/storage/domstorage/localstorage/string-conversion.html
new file mode 100644
index 0000000..aa8bdfd
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/string-conversion.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + localStorage.length);
+
+ log("Testing implicit setters");
+ localStorage.a = null;
+ log("Type/value for null is " + typeof localStorage.a + "/" + localStorage.a);
+ localStorage.b = 0;
+ log("Type/value for 0 is " + typeof localStorage.b + "/" + localStorage.b);
+ localStorage.c = function(){};
+ log("Type/value for function(){} is " + typeof localStorage.c + "/" + localStorage.c);
+
+ log("Testing explicit setters");
+ localStorage.setItem('d', null);
+ log("Type/value for null is " + typeof localStorage.d + "/" + localStorage.d);
+ localStorage.setItem('e', 0);
+ log("Type/value for 0 is " + typeof localStorage.e + "/" + localStorage.e);
+ localStorage.setItem('f', function(){});
+ log("Type/value for function(){} is " + typeof localStorage.f + "/" + localStorage.f);
+
+ log("Testing index setters");
+ localStorage['g'] = null;
+ log("Type/value for null is " + typeof localStorage.g + "/" + localStorage.g);
+ localStorage['h'] = 0;
+ log("Type/value for 0 is " + typeof localStorage.h + "/" + localStorage.h);
+ localStorage['i'] = function(){};
+ log("Type/value for function(){} is " + typeof localStorage.i + "/" + localStorage.i);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test case verifies that local storage only stores strings.
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/localstorage/window-open-expected.txt b/LayoutTests/storage/domstorage/localstorage/window-open-expected.txt
new file mode 100644
index 0000000..9a53f26
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/window-open-expected.txt
@@ -0,0 +1,8 @@
+This is a test to make sure the localStorage object for multiple windows in the same security origin share the same global storage area.
+Value for FOO is BAR
+Logging from second window:
+Value for FOO is BAR
+Value for FOO after changing my own copy is BAR-NEWWINDOW
+Value for FOO in my opening window is BAR-NEWWINDOW
+
+
diff --git a/LayoutTests/storage/domstorage/localstorage/window-open.html b/LayoutTests/storage/domstorage/localstorage/window-open.html
new file mode 100644
index 0000000..b390881
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/window-open.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.waitUntilDone();
+}
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ window.log = log;
+
+ window.localStorage.setItem("FOO", "BAR");
+ log("Value for FOO is " + window.localStorage.getItem("FOO"));
+ window.open("resources/window-open-second.html");
+
+
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a test to make sure the localStorage object for multiple windows in the same security origin share the same global storage area.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/quota-expected.txt b/LayoutTests/storage/domstorage/quota-expected.txt
new file mode 100644
index 0000000..248ff79
--- /dev/null
+++ b/LayoutTests/storage/domstorage/quota-expected.txt
@@ -0,0 +1,32 @@
+Test the DOM Storage quota code.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+Creating 'data' which contains 64K of data
+PASS data.length is 65536
+Putting 'data' into 40 sessionStorage buckets.
+Putting 'data' into another bucket.h
+PASS Insertion worked.
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+Creating 'data' which contains 64K of data
+PASS data.length is 65536
+Putting 'data' into 39 localStorage buckets.
+Putting 'data' into another bucket.h
+PASS Hit exception as expected
+Verify that data was never inserted.
+PASS storage.getItem(39) is null
+Removing bucket 38.
+Adding 'Hello!' into a new bucket.
+PASS Insertion worked.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/domstorage/quota.html b/LayoutTests/storage/domstorage/quota.html
new file mode 100644
index 0000000..58a891b
--- /dev/null
+++ b/LayoutTests/storage/domstorage/quota.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/quota.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/remove-item-expected.txt b/LayoutTests/storage/domstorage/remove-item-expected.txt
new file mode 100644
index 0000000..8a3b391
--- /dev/null
+++ b/LayoutTests/storage/domstorage/remove-item-expected.txt
@@ -0,0 +1,65 @@
+Test .removeItem within DOM Storage.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing sessionStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS storage.foo1 is undefined.
+storage.foo1 = 'bar'
+PASS storage.foo1 is "bar"
+storage.removeItem('foo1')
+PASS storage.foo1 is undefined.
+storage.removeItem('foo1')
+PASS storage.foo1 is undefined.
+
+PASS storage['foo2'] is undefined.
+storage['foo2'] = 'bar'
+PASS storage['foo2'] is "bar"
+storage.removeItem('foo2')
+PASS storage['foo2'] is undefined.
+storage.removeItem('foo2')
+PASS storage['foo2'] is undefined.
+
+PASS storage.getItem('foo3') is null
+storage.setItem('foo3', 'bar')
+PASS storage.getItem('foo3') is "bar"
+storage.removeItem('foo3')
+PASS storage.getItem('foo3') is null
+storage.removeItem('foo3')
+PASS storage.getItem('foo3') is null
+
+
+Testing localStorage
+storage.clear()
+PASS storage.length is 0
+
+PASS storage.foo1 is undefined.
+storage.foo1 = 'bar'
+PASS storage.foo1 is "bar"
+storage.removeItem('foo1')
+PASS storage.foo1 is undefined.
+storage.removeItem('foo1')
+PASS storage.foo1 is undefined.
+
+PASS storage['foo2'] is undefined.
+storage['foo2'] = 'bar'
+PASS storage['foo2'] is "bar"
+storage.removeItem('foo2')
+PASS storage['foo2'] is undefined.
+storage.removeItem('foo2')
+PASS storage['foo2'] is undefined.
+
+PASS storage.getItem('foo3') is null
+storage.setItem('foo3', 'bar')
+PASS storage.getItem('foo3') is "bar"
+storage.removeItem('foo3')
+PASS storage.getItem('foo3') is null
+storage.removeItem('foo3')
+PASS storage.getItem('foo3') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/domstorage/remove-item.html b/LayoutTests/storage/domstorage/remove-item.html
new file mode 100644
index 0000000..f9f6ae3
--- /dev/null
+++ b/LayoutTests/storage/domstorage/remove-item.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/remove-item.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/script-tests/TEMPLATE.html b/LayoutTests/storage/domstorage/script-tests/TEMPLATE.html
new file mode 100644
index 0000000..239a794
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/TEMPLATE.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/script-tests/clear.js b/LayoutTests/storage/domstorage/script-tests/clear.js
new file mode 100644
index 0000000..bf6e5f3
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/clear.js
@@ -0,0 +1,34 @@
+description("Test basic dom storage .clear() functionality.");
+
+function test(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ evalAndLog("storage['FOO'] = 'MyFOO'");
+ evalAndLog("storage['BAR'] = 'MyBar'");
+ shouldBe("storage.length", "2");
+ shouldBeEqualToString("storage['FOO']", "MyFOO");
+ shouldBeEqualToString("storage['BAR']", "MyBar");
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+ shouldBe("storage['FOO']", "undefined"); // FIXME: Wait...shouldn't this be null?
+ shouldBe("storage['BAR']", "undefined"); // ditto
+}
+
+test("sessionStorage");
+debug("");
+debug("");
+test("localStorage");
+
+window.successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/storage/domstorage/script-tests/complex-keys.js b/LayoutTests/storage/domstorage/script-tests/complex-keys.js
new file mode 100644
index 0000000..2b6919f
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/complex-keys.js
@@ -0,0 +1,152 @@
+description("Test dom storage with many different types of keys (as opposed to values)");
+
+function test(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("");
+ shouldBeNull("storage.getItem('FOO')");
+ evalAndLog("storage.setItem('FOO', 'BAR')");
+ shouldBe("storage.length", "1");
+
+ shouldBeEqualToString("storage.getItem('FOO')", "BAR");
+ shouldBeNull("storage.getItem('foo')");
+ shouldBeUndefined("storage.foo");
+ shouldBeUndefined("storage['foo']");
+
+ evalAndLog("storage.foo = 'x'");
+ shouldBeEqualToString("storage.foo", "x");
+ shouldBeEqualToString("storage['foo']", "x");
+ shouldBeEqualToString("storage.getItem('foo')", "x");
+ evalAndLog("storage['foo'] = 'y'");
+ shouldBeEqualToString("storage.foo", "y");
+ shouldBeEqualToString("storage['foo']", "y");
+ shouldBeEqualToString("storage.getItem('foo')", "y");
+ evalAndLog("storage.setItem('foo', 'z')");
+ shouldBeEqualToString("storage.foo", "z");
+ shouldBeEqualToString("storage['foo']", "z");
+ shouldBeEqualToString("storage.getItem('foo')", "z");
+ shouldBe("storage.length", "2");
+
+ debug("");
+ debug("Testing a null key");
+ evalAndLog("storage.setItem(null, 'asdf')");
+ shouldBeEqualToString("storage.getItem('null')", "asdf");
+ shouldBeEqualToString("storage.getItem(null)", "asdf");
+ shouldBeEqualToString("storage['null']", "asdf");
+ shouldBeEqualToString("storage[null]", "asdf");
+ shouldBe("storage.length", "3");
+
+ evalAndLog("storage[null] = 1");
+ shouldBeEqualToString("storage.getItem(null)", "1");
+ evalAndLog("storage['null'] = 2");
+ shouldBeEqualToString("storage.getItem(null)", "2");
+ evalAndLog("storage.setItem('null', 3)");
+ shouldBeEqualToString("storage.getItem(null)", "3");
+ shouldBe("storage.length", "3");
+
+ debug("");
+ debug("Testing an undefined key");
+ evalAndLog("storage[undefined] = 'xyz'");
+ shouldBeEqualToString("storage.getItem('undefined')", "xyz");
+ shouldBeEqualToString("storage.getItem(undefined)", "xyz");
+ shouldBeEqualToString("storage['undefined']", "xyz");
+ shouldBeEqualToString("storage[undefined]", "xyz");
+ shouldBe("storage.length", "4");
+
+ evalAndLog("storage['undefined'] = 4");
+ shouldBeEqualToString("storage.getItem(undefined)", "4");
+ evalAndLog("storage.setItem(undefined, 5)");
+ shouldBeEqualToString("storage.getItem(undefined)", "5");
+ evalAndLog("storage.setItem('undefined', 6)");
+ shouldBeEqualToString("storage.getItem(undefined)", "6");
+ shouldBe("storage.length", "4");
+
+ debug("");
+ debug("Testing a numeric key");
+ evalAndLog("storage['2'] = 'ppp'");
+ shouldBeEqualToString("storage.getItem('2')", "ppp");
+ shouldBeEqualToString("storage.getItem(2)", "ppp");
+ shouldBeEqualToString("storage['2']", "ppp");
+ shouldBeEqualToString("storage[2]", "ppp");
+ shouldBe("storage.length", "5");
+
+ evalAndLog("storage[2] = 7");
+ shouldBeEqualToString("storage.getItem(2)", "7");
+ evalAndLog("storage.setItem(2, 8)");
+ shouldBeEqualToString("storage.getItem(2)", "8");
+ evalAndLog("storage.setItem('2', 9)");
+ shouldBeEqualToString("storage.getItem(2)", "9");
+ shouldBe("storage.length", "5");
+
+ debug("");
+ debug("Setting a non-ascii string to foo");
+ k = String.fromCharCode(255425) + String.fromCharCode(255) + String.fromCharCode(2554252321) + String.fromCharCode(0) + 'hello';
+ evalAndLog("storage[k] = 'hello'");
+ shouldBeEqualToString("storage.getItem(k)", "hello");
+ shouldBeEqualToString("storage[k]", "hello");
+ shouldBe("storage.length", "6");
+
+ debug("");
+ debug("Testing case differences");
+ evalAndLog("storage.foo1 = 'lower1'");
+ evalAndLog("storage.FOO1 = 'UPPER1'");
+ evalAndLog("storage['foo2'] = 'lower2'");
+ evalAndLog("storage['FOO2'] = 'UPPER2'");
+ evalAndLog("storage.setItem('foo3', 'lower3')");
+ evalAndLog("storage.setItem('FOO3', 'UPPER3')");
+ shouldBeEqualToString("storage.foo1", "lower1");
+ shouldBeEqualToString("storage.FOO1", "UPPER1");
+ shouldBeEqualToString("storage['foo2']", "lower2");
+ shouldBeEqualToString("storage['FOO2']", "UPPER2");
+ shouldBeEqualToString("storage.getItem('foo3')", "lower3");
+ shouldBeEqualToString("storage.getItem('FOO3')", "UPPER3");
+ shouldBe("storage.length", "12");
+
+
+ debug("");
+ debug("Testing overriding length");
+ shouldBe("storage.length", "12");
+ shouldBe("storage['length']", "12");
+ shouldBeNull("storage.getItem('length')");
+
+ evalAndLog("storage.length = 0");
+ shouldBe("storage.length", "12");
+ shouldBe("storage['length']", "12");
+ shouldBeNull("storage.getItem('length')");
+
+ evalAndLog("storage['length'] = 0");
+ shouldBe("storage.length", "12");
+ shouldBe("storage['length']", "12");
+ shouldBeNull("storage.getItem('length')");
+
+ evalAndLog("storage.setItem('length', 0)");
+ shouldBe("storage.length", "13");
+ shouldBe("storage['length']", "13");
+ shouldBeEqualToString("storage.getItem('length')", "0");
+
+ evalAndLog("storage.removeItem('length')");
+ shouldBe("storage.length", "12");
+ shouldBe("storage['length']", "12");
+ shouldBeNull("storage.getItem('length')");
+
+ evalAndLog("storage.setItem('length', 0)");
+ shouldBe("storage.length", "13");
+}
+
+test("sessionStorage");
+debug("");
+debug("");
+test("localStorage");
+
+window.successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/storage/domstorage/script-tests/complex-values.js b/LayoutTests/storage/domstorage/script-tests/complex-values.js
new file mode 100644
index 0000000..8c6e29d
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/complex-values.js
@@ -0,0 +1,79 @@
+description("Test some corner case DOM Storage values.");
+
+function testKeyValue(key, value)
+{
+ keyString = "storage['" + key + "']";
+ shouldBeEqualToString("typeof " + keyString, "string");
+ shouldBeEqualToString(keyString, value);
+
+ keyString = "storage." + key;
+ shouldBeEqualToString("typeof " + keyString, "string");
+ shouldBeEqualToString(keyString, value);
+
+ keyString = "storage.getItem('" + key + "')";
+ shouldBeEqualToString("typeof " + keyString, "string");
+ shouldBeEqualToString(keyString, value);
+}
+
+function test(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("");
+ shouldBeEqualToString("typeof storage['foo']", "undefined");
+ shouldBeUndefined("storage['foo']");
+ shouldBeEqualToString("typeof storage.foo", "undefined");
+ shouldBeUndefined("storage.foo");
+ shouldBeEqualToString("typeof storage.getItem('foo')", "object");
+ shouldBeNull("storage.getItem('foo')");
+
+ debug("");
+ evalAndLog("storage.foo1 = null");
+ testKeyValue("foo1", "null");
+ evalAndLog("storage['foo2'] = null");
+ testKeyValue("foo2", "null");
+ evalAndLog("storage.setItem('foo3', null)");
+ testKeyValue("foo3", "null");
+
+ debug("");
+ evalAndLog("storage.foo4 = undefined");
+ testKeyValue("foo4", "undefined");
+ evalAndLog("storage['foo5'] = undefined");
+ testKeyValue("foo5", "undefined");
+ evalAndLog("storage.setItem('foo6', undefined)");
+ testKeyValue("foo6", "undefined");
+
+ debug("");
+ evalAndLog("storage.foo7 = 2");
+ testKeyValue("foo7", "2");
+ evalAndLog("storage['foo8'] = 2");
+ testKeyValue("foo8", "2");
+ evalAndLog("storage.setItem('foo9', 2)");
+ testKeyValue("foo9", "2");
+
+ debug("");
+ k = String.fromCharCode(255425) + String.fromCharCode(255) + String.fromCharCode(2554252321) + String.fromCharCode(0) + 'hello';
+ evalAndLog("storage.foo10 = k");
+ testKeyValue("foo10", k);
+ evalAndLog("storage['foo11'] = k");
+ testKeyValue("foo11", k);
+ evalAndLog("storage.setItem('foo12', k)");
+ testKeyValue("foo12", k);
+}
+
+test("sessionStorage");
+debug("");
+debug("");
+test("localStorage");
+
+window.successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/storage/domstorage/script-tests/quota.js b/LayoutTests/storage/domstorage/script-tests/quota.js
new file mode 100644
index 0000000..ad9afe9
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/quota.js
@@ -0,0 +1,87 @@
+description("Test the DOM Storage quota code.");
+
+function testQuota(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("Creating 'data' which contains 64K of data");
+ data = "X";
+ for (var i=0; i<16; i++)
+ data += data;
+ shouldBe("data.length", "65536");
+
+ debug("Putting 'data' into 39 " + storageString + " buckets.");
+ for (var i=0; i<39; i++)
+ storage[i] = data;
+
+ debug("Putting 'data' into another bucket.h");
+ try {
+ storage[39] = data;
+ testFailed("Did not hit quota error.");
+ } catch (e) {
+ testPassed("Hit exception as expected");
+ }
+
+ debug("Verify that data was never inserted.");
+ shouldBeNull("storage.getItem(39)");
+
+ debug("Removing bucket 38.");
+ storage.removeItem('38');
+
+ debug("Adding 'Hello!' into a new bucket.");
+ try {
+ storage['foo'] = "Hello!";
+ testPassed("Insertion worked.");
+ } catch (e) {
+ testFailed("Exception: " + e);
+ }
+}
+
+function testNoQuota(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("Creating 'data' which contains 64K of data");
+ data = "X";
+ for (var i=0; i<16; i++)
+ data += data;
+ shouldBe("data.length", "65536");
+
+ debug("Putting 'data' into 40 " + storageString + " buckets.");
+ for (var i=0; i<40; i++)
+ storage[i] = data;
+
+ debug("Putting 'data' into another bucket.h");
+ try {
+ storage[40] = data;
+ testPassed("Insertion worked.");
+ } catch (e) {
+ testFailed("Exception: " + e);
+ }
+}
+
+testNoQuota("sessionStorage");
+debug("");
+debug("");
+testQuota("localStorage");
+
+window.successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/storage/domstorage/script-tests/remove-item.js b/LayoutTests/storage/domstorage/script-tests/remove-item.js
new file mode 100644
index 0000000..62731f1
--- /dev/null
+++ b/LayoutTests/storage/domstorage/script-tests/remove-item.js
@@ -0,0 +1,50 @@
+description("Test .removeItem within DOM Storage.");
+
+function test(storageString)
+{
+ storage = eval(storageString);
+ if (!storage) {
+ testFailed(storageString + " DOES NOT exist");
+ return;
+ }
+
+ debug("Testing " + storageString);
+
+ evalAndLog("storage.clear()");
+ shouldBe("storage.length", "0");
+
+ debug("");
+ shouldBeUndefined("storage.foo1");
+ evalAndLog("storage.foo1 = 'bar'");
+ shouldBeEqualToString("storage.foo1", "bar");
+ evalAndLog("storage.removeItem('foo1')");
+ shouldBeUndefined("storage.foo1");
+ evalAndLog("storage.removeItem('foo1')");
+ shouldBeUndefined("storage.foo1");
+
+ debug("");
+ shouldBeUndefined("storage['foo2']");
+ evalAndLog("storage['foo2'] = 'bar'");
+ shouldBeEqualToString("storage['foo2']", "bar");
+ evalAndLog("storage.removeItem('foo2')");
+ shouldBeUndefined("storage['foo2']");
+ evalAndLog("storage.removeItem('foo2')");
+ shouldBeUndefined("storage['foo2']");
+
+ debug("");
+ shouldBeNull("storage.getItem('foo3')");
+ evalAndLog("storage.setItem('foo3', 'bar')");
+ shouldBeEqualToString("storage.getItem('foo3')", "bar");
+ evalAndLog("storage.removeItem('foo3')");
+ shouldBeNull("storage.getItem('foo3')");
+ evalAndLog("storage.removeItem('foo3')");
+ shouldBeNull("storage.getItem('foo3')");
+}
+
+test("sessionStorage");
+debug("");
+debug("");
+test("localStorage");
+
+window.successfullyParsed = true;
+isSuccessfullyParsed();
diff --git a/LayoutTests/storage/domstorage/sessionstorage/delete-removal-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/delete-removal-expected.txt
new file mode 100644
index 0000000..ce04017
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/delete-removal-expected.txt
@@ -0,0 +1,13 @@
+This test makes sure that using the syntax `delete sessionStorage.keyName` works as an alias to `sessionStorage.removeItem(keyName).`
+foo (before anything) is: undefined
+foo (after a named property setter set) is: bar
+foo (after a delete) is: undefined
+foo (after an indexed setter set) is: bar
+foo (after deleting FOO (not foo)) is : bar
+foo (after a delete) is: undefined
+foo (after calling setItem) is: bar
+foo (after a delete) is: undefined
+foo (after a redundant delete) is: undefined
+foo (after a named property setter set) is: bar
+foo (after an indexed delete) is: undefined
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/delete-removal.html b/LayoutTests/storage/domstorage/sessionstorage/delete-removal.html
new file mode 100644
index 0000000..7a4b8d2
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/delete-removal.html
@@ -0,0 +1,51 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById('logger').appendChild(document.createTextNode(a));
+ document.getElementById('logger').appendChild(document.createElement("br"));
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ log("foo (before anything) is: " + sessionStorage.foo);
+ sessionStorage.foo = "bar";
+ log("foo (after a named property setter set) is: " + sessionStorage.foo);
+ delete sessionStorage.foo;
+ log("foo (after a delete) is: " + sessionStorage.foo);
+ sessionStorage["foo"] = "bar";
+ log("foo (after an indexed setter set) is: " + sessionStorage.foo);
+ delete sessionStorage.FOO;
+ log("foo (after deleting FOO (not foo)) is : " + sessionStorage.foo);
+ delete sessionStorage.foo;
+ log("foo (after a delete) is: " + sessionStorage.foo);
+ sessionStorage.setItem("foo", "bar");
+ log("foo (after calling setItem) is: " + sessionStorage.foo);
+ delete sessionStorage.foo;
+ log("foo (after a delete) is: " + sessionStorage.foo);
+ delete sessionStorage.foo;
+ log("foo (after a redundant delete) is: " + sessionStorage.foo);
+ sessionStorage.foo = "bar";
+ log("foo (after a named property setter set) is: " + sessionStorage.foo);
+ delete sessionStorage["foo"];
+ log("foo (after an indexed delete) is: " + sessionStorage.foo);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test makes sure that using the syntax `delete sessionStorage.keyName` works as an alias to `sessionStorage.removeItem(keyName).`<br><hr>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage-expected.txt
new file mode 100644
index 0000000..7c87325
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage-expected.txt
@@ -0,0 +1,9 @@
+This test checks to see that you can enumber a Storage object and get only the keys as a result. The built-in properties of the Storage object should be ignored. The test operates on the SessionStorage object.
+alpha
+bar
+batman
+foo
+fu
+prototypeTestKey
+zeta
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage.html b/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage.html
new file mode 100644
index 0000000..7321f9a
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/enumerate-storage.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function startTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ Storage.prototype.prototypeTestKey = "prototypeTestValue";
+ sessionStorage.foo = "bar";
+ sessionStorage.fu = "baz";
+ sessionStorage.batman = "bin suparman";
+ sessionStorage.bar = "foo";
+ sessionStorage.alpha = "beta";
+ sessionStorage.zeta = "gamma";
+
+ // Enumerate sessionStorage, appending each key onto an array
+ var enumeratedArray = new Array();
+ for (var n in sessionStorage)
+ enumeratedArray.push(n);
+
+ // Sort the array, since the storage order isn't guaranteed
+ enumeratedArray.sort();
+
+ for (var n in enumeratedArray)
+ log(enumeratedArray[n]);
+}
+
+</script>
+</head>
+<body onload="startTest();">
+This test checks to see that you can enumber a Storage object and get only the keys as a result. The built-in properties of the Storage object should be ignored. The test operates on the SessionStorage object.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key-expected.txt
new file mode 100644
index 0000000..f879759
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key-expected.txt
@@ -0,0 +1,9 @@
+This test attempts to enumerate all the keys in sessionStorage with .length + .key(). The built-in properties of the Storage object should be ignored. The test operates on the sessionStorage object.
+alpha
+bar
+batman
+foo
+fu
+prototypeTestKey
+zeta
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key.html b/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key.html
new file mode 100644
index 0000000..27266f1
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/enumerate-with-length-and-key.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function startTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ Storage.prototype.prototypeTestKey = "prototypeTestValue";
+ sessionStorage.foo = "bar";
+ sessionStorage.fu = "baz";
+ sessionStorage.batman = "bin suparman";
+ sessionStorage.bar = "foo";
+ sessionStorage.alpha = "beta";
+ sessionStorage.zeta = "gamma";
+
+ // Enumerate sessionStorage, appending each key onto an array
+ var enumeratedArray = new Array();
+ for (var n in sessionStorage)
+ enumeratedArray.push(n);
+
+ // Sort the array, since the storage order isn't guaranteed
+ enumeratedArray.sort();
+
+ for (var n in enumeratedArray)
+ log(enumeratedArray[n]);
+}
+
+</script>
+</head>
+<body onload="startTest();">
+This test attempts to enumerate all the keys in sessionStorage with .length + .key(). The built-in properties of the Storage object should be ignored. The test operates on the sessionStorage object.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt
new file mode 100644
index 0000000..ff66bdc
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt
@@ -0,0 +1,32 @@
+This is a test to make sure you can get and set values in SessionStorage by index.
+Setting FOO using the index setter.
+Reading FOO:
+BAR
+BAR
+BAR
+
+Setting FOO again, using setItem.
+Reading FOO:
+BAZ
+BAZ
+BAZ
+
+Setting FOO again, using the index setter.
+Reading FOO:
+BAT
+BAT
+BAT
+
+Setting FOO again, using property-slot syntax
+Reading FOO:
+BATMAN
+BATMAN
+BATMAN
+
+Removing FOO, then trying to read it
+Reading FOO:
+undefined
+undefined
+null
+
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html b/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html
new file mode 100644
index 0000000..7922d0b
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function finish()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ finish();
+ return;
+ }
+
+ log("Setting FOO using the index setter.");
+ sessionStorage["FOO"] = "BAR";
+ log("Reading FOO:");
+ log(sessionStorage.FOO);
+ log(sessionStorage["FOO"]);
+ log(sessionStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using setItem.");
+ sessionStorage.setItem("FOO", "BAZ");
+ log("Reading FOO:");
+ log(sessionStorage.FOO);
+ log(sessionStorage["FOO"]);
+ log(sessionStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using the index setter.");
+ sessionStorage["FOO"] = "BAT";
+ log("Reading FOO:");
+ log(sessionStorage.FOO);
+ log(sessionStorage["FOO"]);
+ log(sessionStorage.getItem("FOO"));
+ log("");
+
+ log("Setting FOO again, using property-slot syntax");
+ sessionStorage.FOO = "BATMAN";
+ log("Reading FOO:");
+ log(sessionStorage.FOO);
+ log(sessionStorage["FOO"]);
+ log(sessionStorage.getItem("FOO"));
+ log("");
+
+ log("Removing FOO, then trying to read it");
+ sessionStorage.removeItem("FOO");
+ log("Reading FOO:");
+ log(sessionStorage.FOO);
+ log(sessionStorage["FOO"]);
+ log(sessionStorage.getItem("FOO"));
+ log("");
+
+ finish();
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a test to make sure you can get and set values in SessionStorage by index.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt
new file mode 100644
index 0000000..ed2017a
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage-expected.txt
@@ -0,0 +1,7 @@
+This is a test to make sure that when private browsing is on any attempt to change the sessionStorage area fail.
+Initial value of testItem is: InitialValue
+Caught exception trying to change item: Error: QUOTA_EXCEEDED_ERR: DOM Exception 22
+After change attempt, testItem is: InitialValue
+After remove attempt, testItem is: InitialValue
+After clear attempt, testItem is: InitialValue
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage.html b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage.html
new file mode 100644
index 0000000..8dd7a6a
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/private-browsing-affects-storage.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+ if (!window.layoutTestController) {
+ log("Test only designed to be run under DumpRenderTree");
+ return;
+ }
+
+ sessionStorage.setItem("testItem", "InitialValue");
+ layoutTestController.setPrivateBrowsingEnabled(true);
+ log("Initial value of testItem is: " + sessionStorage.getItem("testItem"));
+
+ try {
+ sessionStorage.setItem("testItem", "ChangedValue");
+ } catch(e) {
+ log("Caught exception trying to change item: " + e);
+ }
+
+ log("After change attempt, testItem is: " + sessionStorage.getItem("testItem"));
+
+ sessionStorage.removeItem("testItem");
+ log("After remove attempt, testItem is: " + sessionStorage.getItem("testItem"));
+
+ sessionStorage.clear();
+ log("After clear attempt, testItem is: " + sessionStorage.getItem("testItem"));
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a test to make sure that when private browsing is on any attempt to change the sessionStorage area fail.
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/resources/clearSessionStorage.js b/LayoutTests/storage/domstorage/sessionstorage/resources/clearSessionStorage.js
new file mode 100644
index 0000000..489ef2a
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/resources/clearSessionStorage.js
@@ -0,0 +1,12 @@
+function clearSessionStorage()
+{
+ var keys = new Array();
+ for (key in sessionStorage)
+ keys.push(key);
+
+ for (key in keys)
+ sessionStorage.removeItem(keys[key]);
+}
+
+if (window.sessionStorage)
+ clearSessionStorage();
diff --git a/LayoutTests/storage/domstorage/sessionstorage/resources/iframe-events-second.html b/LayoutTests/storage/domstorage/sessionstorage/resources/iframe-events-second.html
new file mode 100644
index 0000000..2d7b004
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/resources/iframe-events-second.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+function handleStorageEvent(e)
+{
+ parent.log("Subframe received storage event:");
+ parent.log("Key - " + e.key);
+ parent.log("New Value - " + e.newValue);
+ parent.log("Old Value - " + e.oldValue);
+ parent.log("URI - " + parent.normalizeURL(e.uri));
+ parent.log("Storage Area - " + ((e.storageArea == window.sessionStorage) ? "This window's window.sessionStorage" : "Another window's window.sessionStorage"));
+ parent.log("");
+
+ if (e.key != "Subframe") {
+ parent.log("Subframe about to change sessionStorage...");
+ sessionStorage.setItem("Subframe", "SET");
+ }
+}
+</script>
+</head>
+<body onload="window.addEventListener('storage', handleStorageEvent, false);">
+This is the subframe which exists to make sure that both frames of a same security origin receive the event for that origin's sessionStorage object mutating
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/resources/window-open-second.html b/LayoutTests/storage/domstorage/sessionstorage/resources/window-open-second.html
new file mode 100644
index 0000000..b8dede6
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/resources/window-open-second.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script>
+
+var secondWindowLog = "Logging from second window:<br>";
+
+function log(a)
+{
+ secondWindowLog += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+ window.sessionStorage.setItem("FOO", "BAR-NEWWINDOW");
+ log("Value for FOO after changing my own copy is " + window.sessionStorage.getItem("FOO"));
+
+ log("Value for FOO in my opening window is " + window.opener.sessionStorage.getItem("FOO"));
+
+ window.opener.log(secondWindowLog);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/simple-usage-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/simple-usage-expected.txt
new file mode 100644
index 0000000..399fd08
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/simple-usage-expected.txt
@@ -0,0 +1,13 @@
+This test trys simple operations on SessionStorage
+Length is 0
+Value for FOO is null
+Length is 1
+Value for FOO is BAR
+Key for index 0 is FOO
+Key for index 1 is null
+Key for index -1 is null
+Length is 1
+Value for FOO is BAZ
+Length is 0
+Value for FOO is null
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/simple-usage.html b/LayoutTests/storage/domstorage/sessionstorage/simple-usage.html
new file mode 100644
index 0000000..8e45521
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/simple-usage.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + window.sessionStorage.length);
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+
+ window.sessionStorage.setItem("FOO", "BAR");
+
+ log("Length is " + window.sessionStorage.length);
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+ log("Key for index 0 is " + window.sessionStorage.key(0));
+ log("Key for index 1 is " + window.sessionStorage.key(1));
+ log("Key for index -1 is " + window.sessionStorage.key(-1));
+
+ window.sessionStorage.setItem("FOO", "BAZ");
+
+ log("Length is " + window.sessionStorage.length);
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+
+ window.sessionStorage.removeItem("FOO");
+
+ log("Length is " + window.sessionStorage.length);
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test trys simple operations on SessionStorage<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt
new file mode 100644
index 0000000..65dcb2c
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/string-conversion-expected.txt
@@ -0,0 +1,15 @@
+This test case verifies that session storage only stores strings.
+Length is 0
+Testing implicit setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+Testing explicit setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+Testing index setters
+Type/value for null is string/null
+Type/value for 0 is string/0
+Type/value for function(){} is string/function () {}
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html b/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html
new file mode 100644
index 0000000..64a4e14
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + sessionStorage.length);
+
+ log("Testing implicit setters");
+ sessionStorage.a = null;
+ log("Type/value for null is " + typeof sessionStorage.a + "/" + sessionStorage.a);
+ sessionStorage.b = 0;
+ log("Type/value for 0 is " + typeof sessionStorage.b + "/" + sessionStorage.b);
+ sessionStorage.c = function(){};
+ log("Type/value for function(){} is " + typeof sessionStorage.c + "/" + sessionStorage.c);
+
+ log("Testing explicit setters");
+ sessionStorage.setItem('d', null);
+ log("Type/value for null is " + typeof sessionStorage.d + "/" + sessionStorage.d);
+ sessionStorage.setItem('e', 0);
+ log("Type/value for 0 is " + typeof sessionStorage.e + "/" + sessionStorage.e);
+ sessionStorage.setItem('f', function(){});
+ log("Type/value for function(){} is " + typeof sessionStorage.f + "/" + sessionStorage.f);
+
+ log("Testing index setters");
+ sessionStorage['g'] = null;
+ log("Type/value for null is " + typeof sessionStorage.g + "/" + sessionStorage.g);
+ sessionStorage['h'] = 0;
+ log("Type/value for 0 is " + typeof sessionStorage.h + "/" + sessionStorage.h);
+ sessionStorage['i'] = function(){};
+ log("Type/value for function(){} is " + typeof sessionStorage.i + "/" + sessionStorage.i);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test case verifies that session storage only stores strings.
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/sessionstorage/window-open-expected.txt b/LayoutTests/storage/domstorage/sessionstorage/window-open-expected.txt
new file mode 100644
index 0000000..c613414
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/window-open-expected.txt
@@ -0,0 +1,8 @@
+This is a new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change
+Value for FOO is BAR
+Logging from second window:
+Value for FOO is BAR
+Value for FOO after changing my own copy is BAR-NEWWINDOW
+Value for FOO in my opening window is BAR
+
+
diff --git a/LayoutTests/storage/domstorage/sessionstorage/window-open.html b/LayoutTests/storage/domstorage/sessionstorage/window-open.html
new file mode 100644
index 0000000..34f8f39
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/window-open.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.waitUntilDone();
+}
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ window.log = log;
+
+ window.sessionStorage.setItem("FOO", "BAR");
+ log("Value for FOO is " + window.sessionStorage.getItem("FOO"));
+ window.open("resources/window-open-second.html");
+
+
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This is a new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/domstorage/window-attributes-exist-expected.txt b/LayoutTests/storage/domstorage/window-attributes-exist-expected.txt
new file mode 100644
index 0000000..e7668fd
--- /dev/null
+++ b/LayoutTests/storage/domstorage/window-attributes-exist-expected.txt
@@ -0,0 +1,21 @@
+This test checks to see if window.localStorage, window.sessionStorage and window.onstorage exist.
+window.sessionStorage exists
+Storage object sessionStorage has length
+Storage object sessionStorage has key
+Storage object sessionStorage has getItem
+Storage object sessionStorage has setItem
+Storage object sessionStorage has removeItem
+Storage object sessionStorage has clear
+window.sessionStorage == window.sessionStorage: true
+window.sessionStorage === window.sessionStorage: true
+window.localStorage exists
+Storage object localStorage has length
+Storage object localStorage has key
+Storage object localStorage has getItem
+Storage object localStorage has setItem
+Storage object localStorage has removeItem
+Storage object localStorage has clear
+window.localStorage == window.localStorage: true
+window.localStorage === window.localStorage: true
+window.onstorage exists
+
diff --git a/LayoutTests/storage/domstorage/window-attributes-exist.html b/LayoutTests/storage/domstorage/window-attributes-exist.html
new file mode 100644
index 0000000..d01ba7c
--- /dev/null
+++ b/LayoutTests/storage/domstorage/window-attributes-exist.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function testStorage(name, storage)
+{
+ if ("length" in storage)
+ log("Storage object " + name + " has length");
+ if ("key" in storage)
+ log("Storage object " + name + " has key");
+ if ("getItem" in storage)
+ log("Storage object " + name + " has getItem");
+ if ("setItem" in storage)
+ log("Storage object " + name + " has setItem");
+ if ("removeItem" in storage)
+ log("Storage object " + name + " has removeItem");
+ if ("clear" in storage)
+ log("Storage object " + name + " has clear");
+}
+
+function runTest()
+{
+ if ("sessionStorage" in window) {
+ log("window.sessionStorage exists");
+ testStorage("sessionStorage", window.sessionStorage);
+ log("window.sessionStorage == window.sessionStorage: " + (window.sessionStorage == window.sessionStorage));
+ log("window.sessionStorage === window.sessionStorage: " + (window.sessionStorage === window.sessionStorage));
+ } else
+ log("window.sessionStorage DOES NOT exist");
+
+ if ("localStorage" in window) {
+ log("window.localStorage exists");
+ testStorage("localStorage", window.localStorage);
+ log("window.localStorage == window.localStorage: " + (window.localStorage == window.localStorage));
+ log("window.localStorage === window.localStorage: " + (window.localStorage === window.localStorage));
+ } else
+ log("window.localStorage DOES NOT exist");
+
+ if ("onstorage" in window)
+ log("window.onstorage exists");
+ else
+ log("window.onstorage DOES NOT exist");
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test checks to see if window.localStorage, window.sessionStorage and window.onstorage exist.<br>
+<div id="logger"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/empty-statement-expected.txt b/LayoutTests/storage/empty-statement-expected.txt
new file mode 100644
index 0000000..78d9dca
--- /dev/null
+++ b/LayoutTests/storage/empty-statement-expected.txt
@@ -0,0 +1,2 @@
+Executed an empty statement. If you didn't see a crash or assertion, the test passed.
+
diff --git a/LayoutTests/storage/empty-statement.html b/LayoutTests/storage/empty-statement.html
new file mode 100644
index 0000000..36ec5b8
--- /dev/null
+++ b/LayoutTests/storage/empty-statement.html
@@ -0,0 +1,36 @@
+<html>
+
+<head>
+<script>
+
+function writeMessageToLog(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+function executeEmptyStatement(transaction)
+{
+ transaction.executeSql("");
+ writeMessageToLog("Executed an empty statement. If you didn't see a crash or assertion, the test passed.");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+ var db = openDatabase("EmptyStatementTest", "1.0", "Database for an empty statement test", 1);
+ db.transaction(executeEmptyStatement);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<pre id="console"></pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/execute-sql-args-expected.txt b/LayoutTests/storage/execute-sql-args-expected.txt
new file mode 100644
index 0000000..0e30b4b
--- /dev/null
+++ b/LayoutTests/storage/execute-sql-args-expected.txt
@@ -0,0 +1,29 @@
+PASS. executeSql(null) did not throw an exception
+PASS. executeSql(undefined) did not throw an exception
+PASS. executeSql(0) did not throw an exception
+PASS. executeSql("") did not throw an exception
+PASS. executeSql("", null) did not throw an exception
+PASS. executeSql("", undefined) did not throw an exception
+PASS. executeSql("", []) did not throw an exception
+PASS. executeSql("", [ "arg0" ]) did not throw an exception
+PASS. executeSql("", { }) did not throw an exception
+PASS. executeSql("", { length: 0 }) did not throw an exception
+PASS. executeSql("", { length: 1, 0: "arg0" }) did not throw an exception
+PASS. executeSql("", null, null) did not throw an exception
+PASS. executeSql("", null, undefined) did not throw an exception
+PASS. executeSql("", null, { }) did not throw an exception
+PASS. executeSql("", null, null, null) did not throw an exception
+PASS. executeSql("", null, null, undefined) did not throw an exception
+PASS. executeSql("", null, null, { }) did not throw an exception
+PASS. executeSql() threw an exception as expected.
+PASS. executeSql(throwOnToStringObject) threw an exception as expected.
+PASS. executeSql("", throwOnGetLengthObject) threw an exception as expected.
+PASS. executeSql("", throwOnGetZeroObject) threw an exception as expected.
+PASS. executeSql("", [ throwOnToStringObject ]) threw an exception as expected.
+PASS. executeSql("", 0) threw an exception as expected.
+PASS. executeSql("", "") threw an exception as expected.
+PASS. executeSql("", null, 0) threw an exception as expected.
+PASS. executeSql("", null, "") threw an exception as expected.
+PASS. executeSql("", null, null, 0) threw an exception as expected.
+PASS. executeSql("", null, null, "") threw an exception as expected.
+
diff --git a/LayoutTests/storage/execute-sql-args.html b/LayoutTests/storage/execute-sql-args.html
new file mode 100644
index 0000000..43814c6
--- /dev/null
+++ b/LayoutTests/storage/execute-sql-args.html
@@ -0,0 +1,109 @@
+<html>
+
+<head>
+<script>
+
+var throwOnToStringObject = { };
+throwOnToStringObject.toString = function () { throw "Cannot call toString on this object." };
+
+var throwOnGetLengthObject = { };
+throwOnGetLengthObject.__defineGetter__("length", function () { throw "Cannot get length of this object."; });
+
+var throwOnGetZeroObject = { length: 1 };
+throwOnGetZeroObject.__defineGetter__("0", function () { throw "Cannot get 0 property of this object."; });
+
+var expectNoException = [
+ 'null',
+ 'undefined',
+ '0',
+ '""',
+ '"", null',
+ '"", undefined',
+ '"", []',
+ '"", [ "arg0" ]',
+ '"", { }',
+ '"", { length: 0 }',
+ '"", { length: 1, 0: "arg0" }',
+ '"", null, null',
+ '"", null, undefined',
+ '"", null, { }',
+ '"", null, null, null',
+ '"", null, null, undefined',
+ '"", null, null, { }',
+];
+
+var expectException = [
+ '',
+ 'throwOnToStringObject',
+ '"", throwOnGetLengthObject',
+ '"", throwOnGetZeroObject',
+ '"", [ throwOnToStringObject ]',
+ '"", 0',
+ '"", ""',
+ '"", null, 0',
+ '"", null, ""',
+ '"", null, null, 0',
+ '"", null, null, ""',
+];
+
+function writeMessageToLog(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+function tryExecuteSql(transaction, parameterList)
+{
+ try {
+ eval('transaction.executeSql(' + parameterList + ')');
+ return null;
+ } catch (exception) {
+ return exception;
+ }
+}
+
+function runTransactionTest(transaction, parameterList, expectException)
+{
+ var exception = tryExecuteSql(transaction, parameterList);
+ if (expectException) {
+ if (exception)
+ writeMessageToLog("PASS. executeSql(" + parameterList + ") threw an exception as expected.");
+ else
+ writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") did not throw an exception");
+ } else {
+ if (exception)
+ writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") threw an exception: " + exception);
+ else
+ writeMessageToLog("PASS. executeSql(" + parameterList + ") did not throw an exception");
+ }
+}
+
+function runTransactionTests(transaction)
+{
+ for (i in expectNoException)
+ runTransactionTest(transaction, expectNoException[i], false);
+ for (i in expectException)
+ runTransactionTest(transaction, expectException[i], true);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var db = openDatabase("ExecuteSQLArgsTest", "1.0", "Test of handling of the arguments to SQLTransaction.executeSql", 1);
+ db.transaction(runTransactionTests);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<pre id="console"></pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/hash-change-with-xhr-expected.txt b/LayoutTests/storage/hash-change-with-xhr-expected.txt
new file mode 100644
index 0000000..a481746
--- /dev/null
+++ b/LayoutTests/storage/hash-change-with-xhr-expected.txt
@@ -0,0 +1,3 @@
+Changing the hash to create history entries.
+Db is warmed up
+Test Complete, SUCCESS
diff --git a/LayoutTests/storage/hash-change-with-xhr.html b/LayoutTests/storage/hash-change-with-xhr.html
new file mode 100644
index 0000000..9cbf276
--- /dev/null
+++ b/LayoutTests/storage/hash-change-with-xhr.html
@@ -0,0 +1,140 @@
+<html>
+<head>
+<title>Hash Change with an Open XHR should not stop database transactions</title>
+
+<script type="text/javascript">
+
+var DB_UPDATE_INTERVAL = 100;
+var SEND_XHR_INTERVAL = 100;
+var BACK_INTERVAL = 100;
+var CREATE_HEALTH_TABLE = 'CREATE TABLE IF NOT EXISTS health (key VARCHAR(16) PRIMARY KEY);';
+var UPDATE_DATA = 'REPLACE INTO health VALUES("health-check-key");';
+
+var db = window.openDatabase('bug25710', '1.0', 'LayoutTest for bug 25710', 102400);
+var backIterations;
+var msgDiv;
+var xhrFctIntervalId;
+var backFctIntervalId;
+var successCheckIntervalId;
+var dbFctIntervalId;
+var successes;
+var databaseUpdates;
+var stoppedIntervals;
+
+function log(msg)
+{
+ var newMsg = document.createElement('div');
+ newMsg.innerText = msg;
+ msgDiv.appendChild(newMsg);
+}
+
+function stopIntervals()
+{
+ stoppedIntervals = true;
+ window.clearInterval(dbFctIntervalId);
+ window.clearInterval(xhrFctIntervalId);
+ window.clearInterval(backFctIntervalId);
+}
+
+function stopTest(message)
+{
+ if (!stoppedIntervals)
+ stopIntervals();
+
+ log(message);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function updateDatabase()
+{
+ databaseUpdates++;
+ db.transaction(function(transaction) {
+ transaction.executeSql(UPDATE_DATA, [], function() {}, errorHandler);
+ }, errorHandler, function() {
+ successes++;
+ });
+}
+
+function checkForSuccess()
+{
+ if (successes == databaseUpdates) {
+ stopTest('Test Complete, SUCCESS');
+ window.clearInterval(successCheckIntervalId);
+ }
+}
+
+function errorHandler(tx, error)
+{
+ log('DB error, code: ' + error.code + ', msg: ' + error.message);
+ stopTest('Test Complete, FAILED');
+}
+
+function sendXhr()
+{
+ xhr = new XMLHttpRequest();
+ xhr.open('GET', location.href, true);
+ xhr.send('');
+}
+
+function invokeBack()
+{
+ backIterations--;
+ if (backIterations) {
+ history.back();
+ } else {
+ stopIntervals();
+ // Allow a little time for all the database transactions to complete now we've stopped making them.
+ successCheckIntervalId = window.setInterval(checkForSuccess, 250);
+ // If we don't finish before this time, then we consider the test failed.
+ window.setTimeout(function() { stopTest('Timed out waiting for transactions to complete. FAILED'); }, 20000);
+
+ }
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ msgDiv = document.getElementById('msgs');
+
+ msgDiv.innerHTML = '';
+ backIterations = 10;
+ consecutiveFailures = 0;
+ successes = 0;
+ databaseUpdates = 0;
+ stoppedIntervals = false;
+
+ // Create some hashes so we can call history.back().
+ log('Changing the hash to create history entries.');
+ for (var i = 0; i < backIterations; i++) {
+ location.hash = i;
+ }
+
+ // Init the database.
+ db.transaction(function(transaction) {
+ transaction.executeSql(CREATE_HEALTH_TABLE, [], function() {}, errorHandler);
+ }, errorHandler, function() {
+ // Give a little for the database to 'warm up' before making xhr requests
+ // and calling history.back().
+ window.setTimeout(function() {
+ log('Db is warmed up');
+
+ // NOTE: If we don't make any xhr requests, then the test
+ // successfully passes (comment this line out).
+ xhrFctIntervalId = window.setInterval(sendXhr, SEND_XHR_INTERVAL);
+ backFctIntervalId = window.setInterval(invokeBack, BACK_INTERVAL);
+ dbFctIntervalId = window.setInterval(updateDatabase, DB_UPDATE_INTERVAL);
+ }, 500);
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+<div id="msgs"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/multiple-databases-garbage-collection-expected.txt b/LayoutTests/storage/multiple-databases-garbage-collection-expected.txt
new file mode 100644
index 0000000..d01514a
--- /dev/null
+++ b/LayoutTests/storage/multiple-databases-garbage-collection-expected.txt
@@ -0,0 +1,4 @@
+This test opens two databases, queues up a series of operations on both, then "forgets" about one of them. After forcing GC, resources associated with that database should be freed gracefully.
+Forgotten Database Transaction Complete
+Persistent Database Transaction Complete
+
diff --git a/LayoutTests/storage/multiple-databases-garbage-collection.html b/LayoutTests/storage/multiple-databases-garbage-collection.html
new file mode 100644
index 0000000..45246a9
--- /dev/null
+++ b/LayoutTests/storage/multiple-databases-garbage-collection.html
@@ -0,0 +1,77 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+function GC()
+{
+ // Force GC.
+ if (window.GCController)
+ GCController.collect();
+ else {
+ for (var i = 0; i < 10000; ++i) {
+ ({ });
+ }
+ }
+}
+
+// Variable for the database that will never be forgotten
+var persistentDB = 0;
+// Variable for the forgotten database
+var forgottenDB = 0;
+
+var completed = 0;
+function checkCompletion()
+{
+ if (++completed == 2 && window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ persistentDB = openDatabase("MultipleDatabasesTest1", "1.0", "Test one out of a set of databases being destroyed (1)", 32768);
+ forgottenDB = openDatabase("MultipleDatabasesTest2", "1.0", "Test one out of a set of databases being destroyed (2)", 32768);
+
+ persistentDB.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS DataTest (randomData)", [], function(tx, result) {
+ for (var i = 0; i < 25; ++i)
+ tx.executeSql("INSERT INTO DataTest (randomData) VALUES (1)", []);
+ });
+ }, function(err) {
+ log("Persistent Database Transaction Errored - " + err);
+ checkCompletion();
+ }, function() {
+ log("Persistent Database Transaction Complete");
+ checkCompletion();
+ });
+
+ forgottenDB.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS EmptyTable (unimportantData)", []);
+ }, function(err) {
+ log("Forgotten Database Transaction Errored - " + err);
+ forgottenDB = 0;
+ GC();
+ checkCompletion();
+ }, function() {
+ log("Forgotten Database Transaction Complete");
+ forgottenDB = 0;
+ GC();
+ checkCompletion();
+ });
+}
+
+</script>
+<body onload="runTest();">
+This test opens two databases, queues up a series of operations on both, then "forgets" about one of them.
+After forcing GC, resources associated with that database should be freed gracefully.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/multiple-transactions-expected.txt b/LayoutTests/storage/multiple-transactions-expected.txt
new file mode 100644
index 0000000..3e9c0f6
--- /dev/null
+++ b/LayoutTests/storage/multiple-transactions-expected.txt
@@ -0,0 +1,6 @@
+This is a test to see if the database API allows multiple transactions to be queued on the same database at once:
+Transaction 1 Started
+Transaction 1 Succeeded
+Transaction 2 Started
+Transaction 2 Succeeded
+
diff --git a/LayoutTests/storage/multiple-transactions-on-different-handles-expected.txt b/LayoutTests/storage/multiple-transactions-on-different-handles-expected.txt
new file mode 100644
index 0000000..ba6a2d1
--- /dev/null
+++ b/LayoutTests/storage/multiple-transactions-on-different-handles-expected.txt
@@ -0,0 +1,8 @@
+This is a test to see if queueing up multiple transactions on different handles to the same database results in a deadlock.
+db1 read statement succeeded
+db1 write statement succeeded
+db1 transaction succeeded
+db2 read statement succeeded
+db2 write statement succeeded
+db2 transaction succeeded
+
diff --git a/LayoutTests/storage/multiple-transactions-on-different-handles.html b/LayoutTests/storage/multiple-transactions-on-different-handles.html
new file mode 100644
index 0000000..bcdab82
--- /dev/null
+++ b/LayoutTests/storage/multiple-transactions-on-different-handles.html
@@ -0,0 +1,96 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+var complete = 0;
+
+function checkCompletion()
+{
+ // The test should end after two transactions
+ if (++complete == 2 && window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+// Opens the database used in this test case
+function openTestDatabase()
+{
+ return openDatabase("MultipleTransactionsOnDifferentHandlesTest",
+ "1.0",
+ "Test to make sure that queueing multiple transactions on different DB handles does not result in a deadlock.",
+ 32768);
+}
+
+function statementSuccessCallback(dbName, statementType)
+{
+ log(dbName + " " + statementType + " statement succeeded");
+}
+
+function statementErrorCallback(dbName, statementType, error)
+{
+ log(dbName + " " + statementType + " statement failed: " + error.message);
+}
+
+// Runs a transaction on the given database
+function runTransaction(db, dbName, val)
+{
+ db.transaction(function(tx) {
+ // Execute a read-only statement
+ tx.executeSql("SELECT COUNT(*) FROM Test;", [],
+ function(result) { statementSuccessCallback(dbName, "read"); },
+ function(tx, error) { statementErrorCallback(dbName, "read", error); });
+
+ // Execute a write statement to make sure SQLite tries to acquire an exclusive lock on the DB file
+ tx.executeSql("INSERT INTO Test VALUES (?);", [val],
+ function(result) { statementSuccessCallback(dbName, "write"); },
+ function(tx, error) { statementErrorCallback(dbName, "write", error); });
+ }, function(error) {
+ // Transaction failure callback
+ log(dbName + " transaction failed: " + error.message);
+ checkCompletion();
+ }, function() {
+ // Transaction success callback
+ log(dbName + " transaction succeeded");
+ checkCompletion();
+ });
+}
+
+// We need to guarantee that the Test table exists before we run our test.
+// Therefore, the test code is in the successCallback of the transaction that creates the table.
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ var db = openTestDatabase();
+ db.transaction(function(tx) {
+ // Create the Test table if it does not exist
+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo int);", [],
+ function(result) {}, function(tx, error) {});
+ }, function(error) {
+ log("Creating the Test table failed: " + error.message);
+ }, function() {
+ // The Test table was created successfully
+ var db1 = openTestDatabase();
+ var db2 = openTestDatabase();
+ if (db1 == db2)
+ log("failure: db1 == db2");
+ else {
+ runTransaction(db1, "db1", 1);
+ runTransaction(db2, "db2", 2);
+ }
+ });
+ } catch(err) {}
+}
+</script>
+</head>
+<body onload="runTest();">
+This is a test to see if queueing up multiple transactions on different handles to the same database results in a deadlock.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/multiple-transactions.html b/LayoutTests/storage/multiple-transactions.html
new file mode 100644
index 0000000..56656ca
--- /dev/null
+++ b/LayoutTests/storage/multiple-transactions.html
@@ -0,0 +1,53 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+var complete = 0;
+
+function checkCompletion()
+{
+ if (++complete == 2 && window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var db = openDatabase("MultipleTransactionsTest", "1.0", "Test to make sure multiple transactions can be queued at once for an HTML5 database", 32768);
+
+ db.transaction(function(tx) {
+ log("Transaction 1 Started");
+ }, function(err) {
+ log("Transaction 1 Errored - " + err);
+ checkCompletion();
+ }, function() {
+ log("Transaction 1 Succeeded");
+ checkCompletion();
+ });
+
+ db.transaction(function(tx) {
+ log("Transaction 2 Started");
+ }, function(err) {
+ log("Transaction 2 Errored - " + err);
+ checkCompletion();
+ }, function() {
+ log("Transaction 2 Succeeded");
+ checkCompletion();
+ });
+}
+
+</script>
+<head>
+<body onload="runTest();">
+This is a test to see if the database API allows multiple transactions to be queued on the same database at once:<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/open-database-empty-version-expected.txt b/LayoutTests/storage/open-database-empty-version-expected.txt
new file mode 100644
index 0000000..32e2ffc
--- /dev/null
+++ b/LayoutTests/storage/open-database-empty-version-expected.txt
@@ -0,0 +1,2 @@
+This tests that calling openDatabase with an empty version string does not cause an exception to be thrown.
+SUCCESS! Did not throw an exception.
diff --git a/LayoutTests/storage/open-database-empty-version.html b/LayoutTests/storage/open-database-empty-version.html
new file mode 100644
index 0000000..4604113
--- /dev/null
+++ b/LayoutTests/storage/open-database-empty-version.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script>
+function runTest() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ try {
+ var db = openDatabase('5562470Test', '', 'Test for <rdar://problem/5562470> openDatabase does not work when the version string is empty', 1);
+ } catch (e) {
+ document.getElementById('result').innerHTML = 'FAILURE'
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<div>This tests that calling openDatabase with an empty version string does not cause an exception to be thrown.
+<div id="result">
+SUCCESS! Did not throw an exception.
+</div>
+</body>
+</html>
diff --git a/LayoutTests/storage/open-database-set-empty-version-expected.txt b/LayoutTests/storage/open-database-set-empty-version-expected.txt
new file mode 100644
index 0000000..fa2a450
--- /dev/null
+++ b/LayoutTests/storage/open-database-set-empty-version-expected.txt
@@ -0,0 +1,2 @@
+This tests that calling openDatabase with an empty version string sets the current version of that database to the empty string and subsequent attempts to open the database with a different expected version throw an exception.
+SUCCESS, an exception was thrown. Error: INVALID_STATE_ERR: DOM Exception 11
diff --git a/LayoutTests/storage/open-database-set-empty-version.html b/LayoutTests/storage/open-database-set-empty-version.html
new file mode 100644
index 0000000..f3607fd
--- /dev/null
+++ b/LayoutTests/storage/open-database-set-empty-version.html
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script>
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.clearAllDatabases();
+ }
+
+ try {
+ var db = openDatabase('28417Test', '', 'Test for bug 28417: openDatabase() with empty version sets db version up incorrectly', 0);
+ // The next openDatabase call should fail because the database version was set to '' by the call above, and now we are expecting a different version.
+ var db2 = openDatabase('28417Test', 'test', 'Test for bug 28417: openDatabase() with empty version sets db version up incorrectly', 0);
+ } catch (e) {
+ document.getElementById('result').innerHTML = 'SUCCESS, an exception was thrown. ' + e;
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<div>This tests that calling openDatabase with an empty version string sets the current version of that database to the empty string and subsequent attempts to open the database with a different expected version throw an exception.</div>
+<div id="result">
+FAILURE - an exception was expected.
+</div>
+</body>
+</html>
diff --git a/LayoutTests/storage/open-database-while-transaction-in-progress-expected.txt b/LayoutTests/storage/open-database-while-transaction-in-progress-expected.txt
new file mode 100644
index 0000000..acac8af
--- /dev/null
+++ b/LayoutTests/storage/open-database-while-transaction-in-progress-expected.txt
@@ -0,0 +1,3 @@
+This is a test to see if opening a database while a transaction is running on a different handle to the same database results in a deadlock.
+openDatabase() succeeded.
+
diff --git a/LayoutTests/storage/open-database-while-transaction-in-progress.html b/LayoutTests/storage/open-database-while-transaction-in-progress.html
new file mode 100644
index 0000000..691f6fe
--- /dev/null
+++ b/LayoutTests/storage/open-database-while-transaction-in-progress.html
@@ -0,0 +1,71 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+var complete = 0;
+
+function checkCompletion()
+{
+ // The test should end after two transactions
+ if (++complete == 1 && window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+// Opens the database used in this test case
+function openTestDatabase()
+{
+ return openDatabase("OpenDatabaseWhileTransactionInProgressTest",
+ "1.0",
+ "Test to make sure that calling openDatabase() while a transaction is in progress on a different handle to the same database does not result in a deadlock.",
+ 2100000); // 2MB + epsilon
+}
+
+// See https://bugs.webkit.org/show_bug.cgi?id=28207
+// In order to trigger this bug, the transaction must acquire an exclusive
+// lock on the DB file before trying to obtain a second handle to the same DB.
+// The only way to force SQLite to obtain an exclusive lock is to change more
+// than cache_size * page_size bytes in the database. The default value for
+// cache_size is 2000 pages, and the default page_size is 1024 bytes. So the
+// size of the blob must be at least 2MB.
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ var db1 = openTestDatabase();
+ db1.transaction(function(tx) {
+ // Create the Test table if it does not exist
+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo BLOB);");
+ tx.executeSql("INSERT INTO Test VALUES (ZEROBLOB(2097152));", [],
+ function(result) {
+ var db2 = openTestDatabase();
+ log("openDatabase() succeeded.");
+ },
+ function(tx, error) {
+ log("Executing statement failed: " + error.message);
+ });
+
+ // Clean up the DB to allow for repeated runs of this test
+ // without needing to increase the default allowed quota (5MB)
+ tx.executeSql("DELETE FROM Test;");
+ }, function(error) {
+ log("Transaction failed: " + error.message);
+ }, function() {
+ checkCompletion();
+ });
+ } catch(err) {}
+}
+</script>
+</head>
+<body onload="runTest();">
+This is a test to see if opening a database while a transaction is running on a different handle to the same database results in a deadlock.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/private-browsing-readonly-expected.txt b/LayoutTests/storage/private-browsing-readonly-expected.txt
new file mode 100644
index 0000000..d5f4e0b
--- /dev/null
+++ b/LayoutTests/storage/private-browsing-readonly-expected.txt
@@ -0,0 +1,13 @@
+This test makes sure that attempts to change the database during private browsing fail.
+Setup statement 1 completed successfully
+Setup statement 2 completed successfully
+Private browsing statement 1 completed with an error
+not authorized
+Private browsing statement 2 completed with an error
+not authorized
+Private browsing statement 3 completed with an error
+not authorized
+Private browsing statement 4 completed with an error
+not authorized
+Test ended
+
diff --git a/LayoutTests/storage/private-browsing-readonly.html b/LayoutTests/storage/private-browsing-readonly.html
new file mode 100644
index 0000000..70a209a
--- /dev/null
+++ b/LayoutTests/storage/private-browsing-readonly.html
@@ -0,0 +1,100 @@
+<html>
+<head>
+<script>
+
+function writeMessageToLog(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+var setupStatements = [
+ "CREATE TABLE IF NOT EXISTS PrivateTest1 (randomData)",
+ "INSERT INTO PrivateTest1 VALUES ('somedata')"
+];
+
+var privateBrowsingStatements = [
+ "CREATE TABLE IF NOT EXISTS PrivateTest2 (randomData)",
+ "DELETE FROM PrivateTest1",
+ "DROP TABLE PrivateTest1",
+ "INSERT INTO PrivateTest1 VALUES ('somedata')"
+];
+
+var completed = 0;
+var theTransaction;
+
+function setupSuccessFunction(tx, result)
+{
+ ++completed;
+ writeMessageToLog("Setup statement " + completed + " completed successfully");
+ checkSetupComplete();
+}
+
+function setupErrorFunction(tx, error)
+{
+ ++completed;
+ writeMessageToLog("Setup statement " + completed + " completed with an error\n" + error.message);
+ checkSetupComplete();
+}
+
+function privateBrowsingSuccessFunction(tx, result)
+{
+ ++completed;
+ writeMessageToLog("Private browsing statement " + completed + " completed successfully");
+}
+
+function privateBrowsingErrorFunction(tx, error)
+{
+ ++completed;
+ writeMessageToLog("Private browsing statement " + completed + " completed with an error\n" + error.message);
+}
+
+function runSetup(transaction)
+{
+ theTransaction = transaction;
+ for (i in setupStatements)
+ theTransaction.executeSql(setupStatements[i], [], setupSuccessFunction, setupErrorFunction);
+}
+
+function checkSetupComplete()
+{
+ if (completed == setupStatements.length)
+ runPrivateBrowsingTests();
+}
+
+function runPrivateBrowsingTests()
+{
+ completed = 0;
+
+ if (window.layoutTestController)
+ layoutTestController.setPrivateBrowsingEnabled(true);
+
+ for (i in privateBrowsingStatements)
+ theTransaction.executeSql(privateBrowsingStatements[i], [], privateBrowsingSuccessFunction, privateBrowsingErrorFunction);
+}
+
+function endTest()
+{
+ writeMessageToLog("Test ended");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var database = openDatabase("PrivateBrowsingReadOnlyTest", "1.0", "Test private browsing read-only safety", 1);
+ database.transaction(runSetup, endTest, endTest);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test makes sure that attempts to change the database during private browsing fail.<br>
+<div id="console"></div>
+</body>
+</html>
diff --git a/LayoutTests/storage/quota-tracking-expected.txt b/LayoutTests/storage/quota-tracking-expected.txt
new file mode 100644
index 0000000..62a2c6b
--- /dev/null
+++ b/LayoutTests/storage/quota-tracking-expected.txt
@@ -0,0 +1,15 @@
+UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{file, , 0} database:QuotaManagementDatabase2
+This test checks to make sure that quotas are enforced per-origin instead of per-database, as they were prior to http://trac.webkit.org/projects/webkit/changeset/29983.
+The test clears all databases, sets the quota for the origin to 32k, then tries to insert 17k of data into two databases. If things go as planned, the UI Delegate will be informed of the exceeded quota and should increase the quota for this origin. Inserting 17k of data the third time should succeed again.
+Adding a table
+Inserting some data
+Done adding data
+Adding a table
+Inserting some data
+Expected quota exception - there was not enough remaining storage space, or the storage quota was reached and the user declined to allow more space
+Done adding data
+Adding a table
+Inserting some data
+Done adding data
+Test Complete
+
diff --git a/LayoutTests/storage/quota-tracking.html b/LayoutTests/storage/quota-tracking.html
new file mode 100644
index 0000000..fb2cc9e
--- /dev/null
+++ b/LayoutTests/storage/quota-tracking.html
@@ -0,0 +1,117 @@
+<html>
+<head>
+<script>
+var database1;
+var database2;
+var database3;
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function finishTest()
+{
+ log("Test Complete");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function statementErrorFunction(tx, error)
+{
+ log("Unexpected exception - " + error.message);
+ finishTest();
+}
+
+function transactionErrorFunction(db, error)
+{
+ // We only expect an error message for database2
+ if (db == database2) {
+ log("Expected quota exception - " + error.message);
+ checkCompletion(db);
+ } else {
+ log("Unexpected exception - " + error.message);
+ finishTest();
+ }
+}
+
+function checkCompletion(db)
+{
+ log("Done adding data");
+
+ db.complete = true;
+ if (database1.complete && database2.complete && database3.complete)
+ finishTest();
+ else if (database2.complete)
+ testDatabase(database3);
+ else
+ testDatabase(database2);
+}
+
+function addData(db)
+{
+ db.transaction(function(tx) {
+ log("Inserting some data");
+ tx.executeSql("INSERT INTO DataTest (randomData) VALUES (ZEROBLOB(17408))", [],
+ function(tx, result) { }, statementErrorFunction);
+ if (db == database2) {
+ // Try to run this statement on 'database2' only.
+ // It should not be run, because the previous statement should've
+ // resulted in a failure that made sqlite roll back the entire transaction.
+ tx.executeSql("INSERT INTO DataTest (randomData) VALUES (ZEROBLOB(10))", [],
+ function(tx, result) {
+ log("This statement should not have been run.");
+ finishTest();
+ }, statementErrorFunction);
+ }
+ }, function(error) {
+ transactionErrorFunction(db, error);
+ }, function() {
+ checkCompletion(db);
+ });
+}
+
+function testDatabase(db)
+{
+ db.transaction(function(tx) {
+ log("Adding a table");
+ tx.executeSql("CREATE TABLE DataTest (randomData)", [],
+ function(tx, result) { }, statementErrorFunction);
+ }, function(error) {
+ transactionErrorFunction(db, error);
+ }, function() {
+ addData(db);
+ });
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpDatabaseCallbacks();
+ layoutTestController.setDatabaseQuota(32768);
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ database1 = openDatabase("QuotaManagementDatabase1", "1.0", "Test for quota management <rdar://5628468>", 1);
+ database2 = openDatabase("QuotaManagementDatabase2", "1.0", "Test for quota management <rdar://5628468>", 1);
+ database3 = openDatabase("QuotaManagementDatabase3", "1.0", "Test for quota management <rdar://5628468>", 1);
+ database1.complete = false;
+ database2.complete = false;
+ database3.complete = false;
+
+ testDatabase(database1);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+This test checks to make sure that quotas are enforced per-origin instead of per-database, as they were prior to http://trac.webkit.org/projects/webkit/changeset/29983.<br>
+The test clears all databases, sets the quota for the origin to 32k, then tries to insert 17k of data into two databases. If things go as planned, the UI Delegate will be informed of the exceeded quota and should increase the quota for this origin. Inserting 17k of data the third time should succeed again.
+<pre id="console">
+</pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/read-and-write-transactions-dont-run-together-expected.txt b/LayoutTests/storage/read-and-write-transactions-dont-run-together-expected.txt
new file mode 100644
index 0000000..cc8979c
--- /dev/null
+++ b/LayoutTests/storage/read-and-write-transactions-dont-run-together-expected.txt
@@ -0,0 +1,12 @@
+This test tests that read and write transactions on different handles to the same database don't run together.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+Transaction successful.
+
diff --git a/LayoutTests/storage/read-and-write-transactions-dont-run-together.html b/LayoutTests/storage/read-and-write-transactions-dont-run-together.html
new file mode 100644
index 0000000..a7565b5
--- /dev/null
+++ b/LayoutTests/storage/read-and-write-transactions-dont-run-together.html
@@ -0,0 +1,103 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+function terminateTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function openTestDatabase()
+{
+ return openDatabase("ReadAndWriteTransactionsDontRunTogetherTest",
+ "1.0",
+ "Test to make sure that read and write transactions on different DB handles to the same DB don't run at the same time.",
+ 32768);
+}
+
+var readTransactionsInProgress = 0;
+var writeTransactionsInProgress = 0;
+var totalTransactions = 0;
+var finishedTransactions = 0;
+
+function runTransaction(db, readOnly)
+{
+ var transactionFunction = (readOnly ? db.readTransaction : db.transaction);
+ transactionFunction.call(db, function(tx) {
+ if (readOnly) {
+ if (writeTransactionsInProgress != 0) {
+ log("Read transaction starting while write transaction in progress.");
+ terminateTest();
+ }
+ readTransactionsInProgress++;
+ } else {
+ if ((readTransactionsInProgress != 0) || (writeTransactionsInProgress != 0)) {
+ log("Write transaction starting while another transaction in progress.");
+ terminateTest();
+ }
+ writeTransactionsInProgress++;
+ }
+ tx.executeSql("SELECT * FROM Test;");
+ }, function(error) {
+ log((readOnly ? "Read" : "Write") + " transaction failed: " + error.message);
+ terminateTest();
+ }, function() {
+ finishedTransactions++;
+ if (readOnly)
+ readTransactionsInProgress--;
+ else
+ writeTransactionsInProgress--;
+ log("Transaction successful.");
+ if ((finishedTransactions == totalTransactions) && (readTransactionsInProgress == 0) && (writeTransactionsInProgress == 0))
+ terminateTest();
+ });
+}
+
+function runReadAndWriteTransactions(db1, db2, db3)
+{
+ totalTransactions = 10;
+ finishedTransactions = 0;
+ runTransaction(db1, true);
+ runTransaction(db2, true);
+ runTransaction(db1, false);
+ runTransaction(db1, true);
+ runTransaction(db2, true);
+ runTransaction(db3, true);
+ runTransaction(db1, false);
+ runTransaction(db2, false);
+ runTransaction(db1, true);
+ runTransaction(db3, true);
+}
+
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ var db1 = openTestDatabase();
+ var db2 = openTestDatabase();
+ var db3 = openTestDatabase();
+ db1.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo int);");
+ }, function(error) {
+ log("Cannot create the Test table: " + error.message);
+ terminateTest();
+ }, function() {
+ runReadAndWriteTransactions(db1, db2, db3);
+ });
+ } catch(err) {}
+}
+</script>
+</head>
+<body onload="runTest();">
+This test tests that read and write transactions on different handles to the same database don't run together.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/read-transactions-running-concurrently-expected.txt b/LayoutTests/storage/read-transactions-running-concurrently-expected.txt
new file mode 100644
index 0000000..f58d2df
--- /dev/null
+++ b/LayoutTests/storage/read-transactions-running-concurrently-expected.txt
@@ -0,0 +1,3 @@
+This test tests that two read-only transactions on different handles to the same database run concurrently.
+Read transactions running concurrently.
+
diff --git a/LayoutTests/storage/read-transactions-running-concurrently.html b/LayoutTests/storage/read-transactions-running-concurrently.html
new file mode 100644
index 0000000..b2d862c
--- /dev/null
+++ b/LayoutTests/storage/read-transactions-running-concurrently.html
@@ -0,0 +1,67 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+function terminateTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function openTestDatabase()
+{
+ return openDatabase("ReadTransactionsRunningConcurrentlyTest",
+ "1.0",
+ "Test to make sure that multiple read transactions on different DB handles to the same DB run concurrently.",
+ 32768);
+}
+
+var readTransactionsInProgress = 0;
+
+function runReadTransaction(db)
+{
+ db.readTransaction(function(tx) {
+ readTransactionsInProgress++;
+ }, function(error) {
+ log("Read transaction failed: " + error.message);
+ terminateTest();
+ }, function() {
+ if (readTransactionsInProgress == 2)
+ log("Read transactions running concurrently.");
+ readTransactionsInProgress--;
+ if (readTransactionsInProgress == 0)
+ terminateTest();
+ });
+}
+
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ var db1 = openTestDatabase();
+ var db2 = openTestDatabase();
+ db1.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo int);");
+ }, function(error) {
+ log("Cannot create the Test table: " + error.message);
+ terminateTest();
+ }, function() {
+ runReadTransaction(db1);
+ runReadTransaction(db2);
+ });
+ } catch(err) { log(err); }
+}
+</script>
+</head>
+<body onload="runTest();">
+This test tests that two read-only transactions on different handles to the same database run concurrently.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/resources/database-lock-after-reload-2.html b/LayoutTests/storage/resources/database-lock-after-reload-2.html
new file mode 100644
index 0000000..d73a0df
--- /dev/null
+++ b/LayoutTests/storage/resources/database-lock-after-reload-2.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<script>
+var database;
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function finishTest()
+{
+ log("Test part 2 Complete");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function errorFunction(tx, error)
+{
+ log("Test failed - " + error.message);
+ finishTest();
+}
+
+function addData(db)
+{
+ db.transaction(function(tx) {
+ log("Inserting some data");
+
+ tx.executeSql("INSERT INTO DataTest (testData) VALUES (?)", ["A"], function(tx, result) { }, errorFunction);
+ }, function(){}, function() {
+ finishTest();
+ });
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880);
+ addData(database);
+ } catch(e) {
+ log("Error - could not open database");
+ finishTest();
+ }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<pre id="console">
+</pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/resources/stress-frame.html b/LayoutTests/storage/resources/stress-frame.html
new file mode 100644
index 0000000..b99af3c
--- /dev/null
+++ b/LayoutTests/storage/resources/stress-frame.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+<head>
+<script>
+var db;
+
+try {
+ if (window.openDatabase) {
+ db = openDatabase("StressTest2", "1.0", "Database stress test", 200000);
+ if (!db)
+ alert("Failed to open the database on disk. This is probably because the version was bad or there is not enough space left in this domain's quota");
+ } else
+ alert("Couldn't open the database. Please try with a WebKit nightly with this feature enabled");
+} catch(err) { }
+
+function loaded()
+{
+ db.transaction(function(tx) {
+ tx.executeSql("SELECT COUNT(*) FROM WebkitStickyNotes", [], function(result) {
+ loadNotes();
+ }, function(tx, error) {
+ tx.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT)", [], function(result) {
+ tx.executeSql("INSERT INTO WebKitStickyNotes (id, note) VALUES (?, ?)", [1, 'Text'], function(result) {
+ tx.executeSql("INSERT INTO WebKitStickyNotes (id, note) VALUES (?, ?)", [2, 'More Text'], function(result) {
+ loadNotes();
+ });
+ });
+ });
+ });
+ });
+}
+
+function loadNotes()
+{
+ db.transaction(function(tx) {
+ tx.executeSql("SELECT id, note FROM WebKitStickyNotes", [], function(tx, result) {
+ loadNotes();
+ }, function(tx, error) {
+ alert('Failed to retrieve notes from database - ' + error.message);
+ return;
+ });
+ });
+}
+
+addEventListener('load', loaded, false);
+</script>
+</head>
+<body>
+<p>This test needs to run without crashes and assertion failures for a while.<p>
+</body>
+</html>
diff --git a/LayoutTests/storage/sql-data-types-expected.txt b/LayoutTests/storage/sql-data-types-expected.txt
new file mode 100644
index 0000000..f60caf5
--- /dev/null
+++ b/LayoutTests/storage/sql-data-types-expected.txt
@@ -0,0 +1,7 @@
+PASS: property 'timestamp' ok, type was number
+PASS: property 'id' ok, type was number
+PASS: property 'real' ok, type was number
+PASS: property 'text' ok, type was string
+PASS: property 'blob' ok, type was string
+PASS: database clean up ok.
+
diff --git a/LayoutTests/storage/sql-data-types.html b/LayoutTests/storage/sql-data-types.html
new file mode 100644
index 0000000..cd1c98f
--- /dev/null
+++ b/LayoutTests/storage/sql-data-types.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script type="text/javascript" src="sql-data-types.js"></script>
+</head>
+
+<body onload="runTest()">
+<pre id="console"></pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/sql-data-types.js b/LayoutTests/storage/sql-data-types.js
new file mode 100644
index 0000000..36fcd01
--- /dev/null
+++ b/LayoutTests/storage/sql-data-types.js
@@ -0,0 +1,87 @@
+//description("This test verifies that the javascript values returned by database queries are of same type as the values put into the database.");
+
+function writeMessageToLog(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+function notifyDone(str) {
+ writeMessageToLog(str);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var testValues = {
+ timestamp: new Date("Wed Feb 06 2008 12:16:52 GMT+0200 (EET)").valueOf(),
+ id: 1001,
+ real: 101.444,
+ text: "WebKit db TEXT",
+ blob: "supercalifragilistic"
+};
+
+function shouldBeSameTypeAndValue(propName, testValue, result) {
+ if (testValue == result && typeof testValue == typeof result) {
+ writeMessageToLog("PASS: property '" + propName + "' ok, type was " + typeof result);
+ return true;
+ }
+ writeMessageToLog("FAIL: property '" + propName + "' failed."
+ + " expected: " + typeof testValue + ":'" + testValue + "' "
+ + " got: " + typeof result + ":'" + result +"'");
+ return false;
+}
+
+function testDBValues(tx, result) {
+ var rs = result.rows.item(0);
+ // Avoid for .. in because (theretically) the order can change
+ i = "timestamp"; shouldBeSameTypeAndValue(i, testValues[i], rs[i]);
+ i = "id"; shouldBeSameTypeAndValue(i, testValues[i], rs[i]);
+ i = "real"; shouldBeSameTypeAndValue(i, testValues[i], rs[i]);
+ i = "text"; shouldBeSameTypeAndValue(i, testValues[i], rs[i]);
+ i = "blob"; shouldBeSameTypeAndValue(i, testValues[i], rs[i]);
+
+ tx.executeSql("DROP TABLE DataTypeTestTable", [],
+ function(tx, result) {
+ notifyDone("PASS: database clean up ok.");
+ },
+ function(tx, result) {
+ notifyDone("FAIL: Database clean up failed.");
+ });
+}
+
+function fetchDBValuesStmt(tx, result) {
+ tx.executeSql("SELECT * FROM DataTypeTestTable", [],
+ testDBValues,
+ function(tx,error) {
+ notifyDone("FAIL: Error fetching values from the db.")
+ });
+}
+
+function insertTestValuesStmt(tx, result) {
+ tx.executeSql("INSERT INTO DataTypeTestTable (id, real, timestamp, text, blob) VALUES (?,?,?,?,?)",
+ [testValues.id, testValues.real, testValues.timestamp, testValues.text, testValues.blob],
+ fetchDBValuesStmt,
+ function(tx, error) {
+ notifyDone("FAIL: Error inserting values to the db.");
+ });
+}
+
+function createTestDBStmt(tx)
+{
+ tx.executeSql("CREATE TABLE IF NOT EXISTS DataTypeTestTable (id INTEGER UNIQUE, real REAL, timestamp INTEGER, text TEXT, blob BLOB)", [],
+ insertTestValuesStmt,
+ function(tx, error) {
+ notifyDone("FAIL: Error creating the db.");
+ });
+}
+
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+ var db = openDatabase("DataTypeTest", "1.0", "Database for sql data type test", 1);
+ if (db)
+ db.transaction(createTestDBStmt);
+ else
+ notifyDone("FAIL: Error opening the db");
+}
diff --git a/LayoutTests/storage/statement-error-callback-expected.txt b/LayoutTests/storage/statement-error-callback-expected.txt
new file mode 100644
index 0000000..ca117a8
--- /dev/null
+++ b/LayoutTests/storage/statement-error-callback-expected.txt
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 0: Exception in Statement error callback
+This test confirms that if the statement error callback returns true or throws an exception we do not execute any further statements in that transaction and instead execute the transaction error callback immediately.
+PASS - the transaction error callback was invoked.
+PASS - the transaction error callback was invoked.
+Test Complete
+
diff --git a/LayoutTests/storage/statement-error-callback.html b/LayoutTests/storage/statement-error-callback.html
new file mode 100644
index 0000000..3675548
--- /dev/null
+++ b/LayoutTests/storage/statement-error-callback.html
@@ -0,0 +1,68 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function finishTest()
+{
+ log("Test Complete");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var txCallbackCount = 0;
+var NUMBER_OF_TRANSACTIONS = 2;
+
+function transactionErrorFunction(error)
+{
+ log("PASS - the transaction error callback was invoked.");
+ if (++txCallbackCount == NUMBER_OF_TRANSACTIONS)
+ finishTest();
+}
+
+function transactionSuccessFunction(message)
+{
+ log("FAIL - the transaction success callback should not be invoked.");
+ if (++txCallbackCount == NUMBER_OF_TRANSACTIONS)
+ finishTest();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var database = openDatabase("bug-28872", "1.0", "statement error callback test", 1024);
+
+ database.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)");
+ tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']);
+ tx.executeSql("THIS STATEMENT WILL FAIL", [], function(message) { log("FAIL - this statement should have failed"); finishTest(); }, function(error) { return true; });
+ tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], function(message) { log("FAIL - This statement should not have been executed"); }, function(message) { log("FAIL - This statement should not have been executed"); });
+ }, transactionErrorFunction, transactionSuccessFunction);
+
+ database.transaction(function(tx) {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)");
+ tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']);
+ tx.executeSql("THIS STATEMENT WILL FAIL", [], function(message) { log("FAIL - this statement should have failed"); finishTest(); }, function(error) { throw "Exception in Statement error callback"; return false; });
+ tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], function(message) { log("FAIL - This statement should not have been executed"); }, function(message) { log("FAIL - This statement should not have been executed"); });
+ }, transactionErrorFunction, transactionSuccessFunction);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+This test confirms that if the statement error callback returns true or throws an exception we do not execute any further statements in that transaction and instead execute the transaction error callback immediately.
+<pre id="console">
+</pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/success-callback-expected.txt b/LayoutTests/storage/success-callback-expected.txt
new file mode 100644
index 0000000..7619024
--- /dev/null
+++ b/LayoutTests/storage/success-callback-expected.txt
@@ -0,0 +1,5 @@
+This test confirms that a successful transaction - both with and without a statement - receives its successCallback
+Transaction succeeded - Transaction with one statement
+Transaction succeeded - Empty transaction
+Test Complete
+
diff --git a/LayoutTests/storage/success-callback.html b/LayoutTests/storage/success-callback.html
new file mode 100644
index 0000000..c237aba
--- /dev/null
+++ b/LayoutTests/storage/success-callback.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+function finishTest()
+{
+ log("Test Complete");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function errorFunction(error)
+{
+ log("Test failed - " + error.message);
+ finishTest();
+}
+
+var successCount = 0;
+
+function successFunction(message)
+{
+ log("Transaction succeeded - " + message);
+ if (++successCount == 2)
+ finishTest();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var database = openDatabase("SuccessCallbackDatabase", "1.0", "Test for success callback <rdar://5737692>", 1);
+ database.transaction(function(tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS SuccessCallbackTest (randomData)", []); }, errorFunction, function() { successFunction("Transaction with one statement"); });
+ database.transaction(function(tx) { }, errorFunction, function() { successFunction("Empty transaction"); });
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+This test confirms that a successful transaction - both with and without a statement - receives its successCallback
+<pre id="console">
+</pre>
+</body>
+
+</html>
diff --git a/LayoutTests/storage/test-authorizer-expected.txt b/LayoutTests/storage/test-authorizer-expected.txt
new file mode 100644
index 0000000..9ee0603
--- /dev/null
+++ b/LayoutTests/storage/test-authorizer-expected.txt
@@ -0,0 +1,68 @@
+This test tests the database authorizer.
+SQLITE_CREATE_TABLE statement succeeded.
+SQLITE_CREATE_INDEX statement succeeded.
+SQLITE_CREATE_TEMP_TABLE statement succeeded.
+SQLITE_CREATE_TEMP_TRIGGER statement succeeded.
+SQLITE_CREATE_TEMP_VIEW statement succeeded.
+SQLITE_CREATE_TRIGGER statement succeeded.
+SQLITE_CREATE_VIEW statement succeeded.
+SQLITE_CREATE_VTABLE statement failed: not authorized
+SQLITE_READ statement succeeded.
+SQLITE_SELECT statement succeeded.
+SQLITE_DELETE statement succeeded.
+SQLITE_INSERT statement succeeded.
+SQLITE_UPDATE statement succeeded.
+SQLITE_PRAGMA statement failed: not authorized
+SQLITE_ALTER_TABLE statement succeeded.
+SQLITE_ALTER_TABLE statement succeeded.
+SQLITE_TRANSACTION statement failed: not authorized
+SQLITE_ATTACH statement failed: not authorized
+SQLITE_DETACH statement failed: not authorized
+SQLITE_REINDEX statement succeeded.
+SQLITE_ANALYZE statement failed: not authorized
+SQLITE_DROP_INDEX statement succeeded.
+SQLITE_DROP_TEMP_TABLE statement succeeded.
+SQLITE_DROP_TEMP_TRIGGER statement succeeded.
+SQLITE_DROP_TEMP_VIEW statement succeeded.
+SQLITE_DROP_TRIGGER statement succeeded.
+SQLITE_DROP_VIEW statement succeeded.
+SQLITE_DROP_TABLE statement succeeded.
+Write transaction succeeded.
+SQLITE_CREATE_TABLE statement failed: not authorized
+SQLITE_CREATE_TABLE statement succeeded.
+SQLITE_CREATE_INDEX statement failed: not authorized
+SQLITE_CREATE_TEMP_TABLE statement failed: not authorized
+SQLITE_CREATE_TEMP_TRIGGER statement failed: not authorized
+SQLITE_CREATE_TEMP_VIEW statement failed: not authorized
+SQLITE_CREATE_TRIGGER statement failed: not authorized
+SQLITE_CREATE_VIEW statement failed: not authorized
+SQLITE_CREATE_VTABLE statement failed: not authorized
+SQLITE_CREATE_INDEX statement succeeded.
+SQLITE_CREATE_TEMP_TABLE statement succeeded.
+SQLITE_CREATE_TEMP_TRIGGER statement succeeded.
+SQLITE_CREATE_TEMP_VIEW statement succeeded.
+SQLITE_CREATE_TRIGGER statement succeeded.
+SQLITE_CREATE_VIEW statement succeeded.
+SQLITE_CREATE_VTABLE statement failed: not authorized
+SQLITE_READ statement succeeded.
+SQLITE_SELECT statement succeeded.
+SQLITE_DELETE statement failed: not authorized
+SQLITE_INSERT statement failed: not authorized
+SQLITE_UPDATE statement failed: not authorized
+SQLITE_PRAGMA statement failed: not authorized
+SQLITE_ALTER_TABLE statement failed: not authorized
+SQLITE_ALTER_TABLE statement failed: no such table: TestTable
+SQLITE_TRANSACTION statement failed: not authorized
+SQLITE_ATTACH statement failed: not authorized
+SQLITE_DETACH statement failed: not authorized
+SQLITE_REINDEX statement failed: not authorized
+SQLITE_ANALYZE statement failed: not authorized
+SQLITE_DROP_INDEX statement failed: not authorized
+SQLITE_DROP_TEMP_TABLE statement failed: not authorized
+SQLITE_DROP_TEMP_TRIGGER statement failed: not authorized
+SQLITE_DROP_TEMP_VIEW statement failed: not authorized
+SQLITE_DROP_TRIGGER statement failed: not authorized
+SQLITE_DROP_VIEW statement failed: not authorized
+SQLITE_DROP_TABLE statement failed: not authorized
+Read transactions succeeded.
+
diff --git a/LayoutTests/storage/test-authorizer.html b/LayoutTests/storage/test-authorizer.html
new file mode 100644
index 0000000..57785a6
--- /dev/null
+++ b/LayoutTests/storage/test-authorizer.html
@@ -0,0 +1,175 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.body.innerHTML += message + "<br>";
+}
+
+function terminateTest()
+{
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function logAndTerminateTest(message, error)
+{
+ log(message + ": " + error.message);
+ terminateTest();
+}
+
+function cleanup(db)
+{
+ db.transaction(function(tx) {
+ tx.executeSql("DROP TABLE IF EXISTS Test;");
+ tx.executeSql("DROP INDEX IF EXISTS TestIndex;");
+ tx.executeSql("DROP VIEW IF EXISTS TestView;");
+ tx.executeSql("DROP TRIGGER IF EXISTS TestTrigger;");
+ }, function(error) { logAndTerminateTest("Cleanup failed", error); });
+}
+
+function statementSuccessCallback(statementType)
+{
+ log(statementType + " statement succeeded.");
+}
+
+function statementErrorCallback(statementType, error)
+{
+ log(statementType + " statement failed: " + error.message);
+ return false;
+}
+
+function executeStatement(tx, statement, operation)
+{
+ tx.executeSql(statement, [],
+ function(result) { statementSuccessCallback(operation); },
+ function(tx, error) { return statementErrorCallback(operation, error); });
+}
+
+function createTableCallback(tx)
+{
+ executeStatement(tx, "CREATE TABLE Test (Foo int);", "SQLITE_CREATE_TABLE");
+}
+
+function createStatementsCallback(tx)
+{
+ executeStatement(tx, "CREATE INDEX TestIndex ON Test (Foo);", "SQLITE_CREATE_INDEX");
+
+ // Even though the following query should trigger a SQLITE_CREATE_TEMP_INDEX operation
+ // (according to http://www.sqlite.org/tempfiles.html), it doesn't, and I'm not aware
+ // of any other way to trigger this operation. So we'll skip it for now.
+ //executeStatement(tx, "SELECT * FROM Test WHERE Foo IN (1, 2, 3);", "SQLITE_CREATE_TEMP_INDEX");
+
+ executeStatement(tx, "CREATE TEMP TABLE TestTempTable (Foo int);", "SQLITE_CREATE_TEMP_TABLE");
+ executeStatement(tx, "CREATE TEMP TRIGGER TestTempTrigger INSERT ON Test BEGIN SELECT COUNT(*) FROM Test; END;", "SQLITE_CREATE_TEMP_TRIGGER");
+ executeStatement(tx, "CREATE TEMP VIEW TestTempView AS SELECT COUNT(*) FROM Test;", "SQLITE_CREATE_TEMP_VIEW");
+ executeStatement(tx, "CREATE TRIGGER TestTrigger INSERT ON Test BEGIN SELECT COUNT(*) FROM Test; END;", "SQLITE_CREATE_TRIGGER");
+ executeStatement(tx, "CREATE VIEW TestView AS SELECT COUNT(*) FROM Test;", "SQLITE_CREATE_VIEW");
+ executeStatement(tx, "CREATE VIRTUAL TABLE TestVirtualTable USING MissingModule;", "SQLITE_CREATE_VTABLE");
+}
+
+function otherStatementsCallback(tx)
+{
+ executeStatement(tx, "SELECT COUNT(*) FROM Test;", "SQLITE_READ");
+ executeStatement(tx, "SELECT COUNT(*) FROM Test;", "SQLITE_SELECT");
+ executeStatement(tx, "DELETE FROM Test;", "SQLITE_DELETE");
+ executeStatement(tx, "INSERT INTO Test VALUES (1);", "SQLITE_INSERT");
+ executeStatement(tx, "UPDATE Test SET Foo = 2 WHERE Foo = 1;", "SQLITE_UPDATE");
+ executeStatement(tx, "PRAGMA cache_size;", "SQLITE_PRAGMA");
+
+ executeStatement(tx, "ALTER TABLE Test RENAME TO TestTable;", "SQLITE_ALTER_TABLE");
+ // Rename the table back to its original name
+ executeStatement(tx, "ALTER TABLE TestTable RENAME To Test;", "SQLITE_ALTER_TABLE");
+
+ executeStatement(tx, "BEGIN TRANSACTION;", "SQLITE_TRANSACTION");
+ executeStatement(tx, "ATTACH main AS TestMain;", "SQLITE_ATTACH");
+ executeStatement(tx, "DETACH TestMain;", "SQLITE_DETACH");
+ executeStatement(tx, "REINDEX;", "SQLITE_REINDEX");
+ executeStatement(tx, "ANALYZE;", "SQLITE_ANALYZE");
+
+ // SQLITE_FUNCTION: allowed write mode
+ // There is no SQL/Javascript API to add user-defined functions to SQLite,
+ // so we cannot test this operation
+}
+
+function dropStatementsCallback(tx)
+{
+ executeStatement(tx, "DROP INDEX TestIndex;", "SQLITE_DROP_INDEX");
+
+ // SQLITE_DROP_TEMP_INDEX: allowed in write mode
+ // Not sure how to test this: temp indexes are automatically dropped when
+ // the database is closed, but HTML5 doesn't specify a closeDatabase() call.
+
+ executeStatement(tx, "DROP TABLE TestTempTable;", "SQLITE_DROP_TEMP_TABLE");
+ executeStatement(tx, "DROP TRIGGER TestTempTrigger;", "SQLITE_DROP_TEMP_TRIGGER");
+ executeStatement(tx, "DROP VIEW TestTempView;", "SQLITE_DROP_TEMP_VIEW");
+ executeStatement(tx, "DROP TRIGGER TestTrigger;", "SQLITE_DROP_TRIGGER");
+ executeStatement(tx, "DROP VIEW TestView;", "SQLITE_DROP_VIEW");
+
+ // SQLITE_DROP_VTABLE: allowed in write mode
+ // Not sure how to test this: we cannot create a virtual table because we do not
+ // have SQL/Javascript APIs to register a module that implements a virtual table.
+ // Therefore, trying to drop a virtual table will always fail (no such table)
+ // before even getting to the authorizer.
+
+ executeStatement(tx, "DROP TABLE Test;", "SQLITE_DROP_TABLE");
+}
+
+function testReadWriteMode(db)
+{
+ db.transaction(function(tx) {
+ createTableCallback(tx);
+ createStatementsCallback(tx);
+ otherStatementsCallback(tx);
+ dropStatementsCallback(tx);
+ },
+ function(error) { logAndTerminateTest("Write transaction failed", error); },
+ function() { log("Write transaction succeeded."); });
+}
+
+function testReadOnlyMode(db)
+{
+ // Test the 'CREATE TABLE' operation; it should be disallowed
+ db.readTransaction(createTableCallback,
+ function(error) { logAndTerminateTest("Read 'CREATE TABLE' transaction failed", error); });
+
+ // In order to test all other 'CREATE' operations, we must create the table first
+ db.transaction(createTableCallback,
+ function(error) { logAndTerminateTest("Write 'CREATE TABLE' transaction failed", error); });
+ db.readTransaction(createStatementsCallback,
+ function(error) { logAndTerminateTest("Read 'CREATE' transaction failed", error); });
+
+ // In order to test the 'DROP' and 'other' operations, we need to first create the respective entities
+ db.transaction(createStatementsCallback,
+ function(error) { logAndTerminateTest("Write 'CREATE' transaction failed", error); });
+ db.readTransaction(otherStatementsCallback,
+ function(error) { logAndTerminateTest("Read 'other' transaction failed", error); });
+
+ // Hack: insert an empty write transaction to guaratee that these transactions are executed sequentially
+ db.transaction(function(tx) { });
+ db.readTransaction(dropStatementsCallback,
+ function(error) { logAndTerminateTest("Read 'DROP' transaction failed", error); },
+ function() { log("Read transactions succeeded."); terminateTest(); });
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ try {
+ var db = openDatabase("AuthorizerTest", "1.0", "Tests the database authorizer.", 32768);
+ cleanup(db);
+ testReadWriteMode(db);
+ testReadOnlyMode(db);
+ } catch(err) {}
+}
+</script>
+</head>
+<body onload="runTest();">
+This test tests the database authorizer.<br>
+</body>
+</html>
diff --git a/LayoutTests/storage/transaction-callback-exception-crash-expected.txt b/LayoutTests/storage/transaction-callback-exception-crash-expected.txt
new file mode 100644
index 0000000..0e2eb33
--- /dev/null
+++ b/LayoutTests/storage/transaction-callback-exception-crash-expected.txt
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 0: TransactionCallbackError
+If WebKit doesn't crash, this test has passed
diff --git a/LayoutTests/storage/transaction-callback-exception-crash.html b/LayoutTests/storage/transaction-callback-exception-crash.html
new file mode 100644
index 0000000..4bcc732
--- /dev/null
+++ b/LayoutTests/storage/transaction-callback-exception-crash.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+var db = openDatabase("15976Test", "1.0", "Test for http://bugs.webkit.org/show_bug.cgi?id=15976", 1);
+db.transaction(function(tx) {
+ if (window.layoutTestController)
+ window.setTimeout(function() { layoutTestController.notifyDone() }, 0);
+ throw "TransactionCallbackError";
+});
+</script>
+</head>
+<body>
+If WebKit doesn't crash, this test has passed
+</body>
+</html>
diff --git a/LayoutTests/storage/transaction-error-callback-expected.txt b/LayoutTests/storage/transaction-error-callback-expected.txt
new file mode 100644
index 0000000..6fb33bd
--- /dev/null
+++ b/LayoutTests/storage/transaction-error-callback-expected.txt
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 63: [object Object]
+CONSOLE MESSAGE: line 63: [object Object]
+This test confirms that SQLTransactionErrorCallback is invoked correctly and regardless of its output, the transaction is always rolled back on failure.
+Testing transaction failing mid-way and error callback returning true : SUCCESS
+Testing transaction failing mid-way and error callback return false : SUCCESS
+Testing statement callback throwing exception and error callback returning true : SUCCESS
+Testing statement callback throwing exception and error callback returning false : SUCCESS
+All Tests are complete.
+
diff --git a/LayoutTests/storage/transaction-error-callback.html b/LayoutTests/storage/transaction-error-callback.html
new file mode 100644
index 0000000..90b2ed0
--- /dev/null
+++ b/LayoutTests/storage/transaction-error-callback.html
@@ -0,0 +1,105 @@
+<html>
+<head>
+<script>
+
+function log(message)
+{
+ document.getElementById("console").innerHTML += message + "<br>";
+}
+
+// signal to layoutTestController when this reaches zero.
+var testCount = 4;
+// we first retrieve and store the number of rows already in our test database.
+// our goal is to keep the number unchanged through the tests.
+var initialRowCount = 0;
+var database;
+var successCallbackCalled;
+
+function finishTest()
+{
+ if (--testCount)
+ return;
+
+ log("All Tests are complete.");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function successCallback()
+{
+ successCallbackCalled = true;
+}
+
+function verifySuccess(msg)
+{
+ database.transaction(function(tx)
+ {
+ tx.executeSql("SELECT count(*) AS count FROM ErrorCallbackTest", [], function(tx, rs)
+ {
+ log(msg + " : " + (rs.rows.item(0).count == initialRowCount && !successCallbackCalled ? "SUCCESS" : "FAILURE"));
+ finishTest();
+ });
+ });
+}
+
+function failMidWay(errorCallback)
+{
+ successCallbackCalled = false;
+ database.transaction(function(tx)
+ {
+ tx.executeSql("INSERT INTO ErrorCallbackTest(someValue) VALUES(?);", [ 1 ]);
+ tx.executeSql("MUTTER SOMETHING ILLEGIBLE");
+ }, errorCallback, successCallback);
+}
+
+function statementCallbackThrowsException(errorCallback)
+{
+ successCallbackCalled = false;
+ database.transaction(function(tx)
+ {
+ tx.executeSql("INSERT INTO ErrorCallbackTest(someValue) VALUES(?);", [ 1 ], function()
+ {
+ throw {};
+ });
+ });
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.clearAllDatabases();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ database = openDatabase("ErrorCallbackDatabase", "1.0", "Test for error callback", 1);
+ database.transaction(function(tx)
+ {
+ tx.executeSql("CREATE TABLE IF NOT EXISTS ErrorCallbackTest (someValue)", []);
+ tx.executeSql("SELECT count(*) AS count FROM ErrorCallbackTest", [], function(tx, rs)
+ {
+ initialRowCount = rs.rows.item(0).count;
+ });
+ });
+
+ failMidWay(function() { return true; });
+ verifySuccess("Testing transaction failing mid-way and error callback returning true");
+ failMidWay(function() { return false; });
+ verifySuccess("Testing transaction failing mid-way and error callback return false");
+ statementCallbackThrowsException(function() { return true; });
+ verifySuccess("Testing statement callback throwing exception and error callback returning true");
+ statementCallbackThrowsException(function() { return false; });
+ verifySuccess("Testing statement callback throwing exception and error callback returning false");
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+This test confirms that <code>SQLTransactionErrorCallback</code> is invoked correctly and regardless of its output, the transaction is always rolled back on failure.
+<pre id="console">
+</pre>
+</body>
+
+</html>