Commit 1c19f401 authored by jianli@chromium.org's avatar jianli@chromium.org
Browse files

Change createObjectURL and revokeObjectURL to put under webkitURL.

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

Reviewed by Darin Fisher.

Source/WebCore:

Note that we add "webkit" vendor prefix to URL that is introduced in
the latest File API spec.

For the time being, we implement webkitURL as a readonly attribute
instead of a constructor so that we will not expose prototype property,
as required by the spec.

* Android.derived.jscbindings.mk:
* Android.derived.v8bindings.mk:
* Android.mk:
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* html/DOMURL.cpp: Added.
* html/DOMURL.h: Added.
* html/DOMURL.idl: Added.
* inspector/front-end/NetworkPanel.js:
* inspector/front-end/utilities.js:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::webkitURL):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::webkitURL):
* workers/WorkerContext.h:
* workers/WorkerContext.idl:

LayoutTests:

Change all related test scripts and results to account for this change.

* fast/dom/Window/script-tests/window-property-descriptors.js:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/Window/window-properties.html:
* fast/dom/script-tests/prototype-inheritance-2.js:
* fast/dom/script-tests/prototype-inheritance.js:
* fast/files/apply-blob-url-to-img.html:
* fast/files/apply-blob-url-to-xhr.html:
* fast/files/create-blob-url-crash.html:
* fast/files/revoke-blob-url.html:
* fast/files/workers/resources/worker-apply-blob-url-to-xhr.js:
(onmessage):
* platform/qt/fast/dom/Window/window-properties-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 129fb5fc
2011-01-13 Jian Li <jianli@chromium.org>
Reviewed by Darin Fisher.
Change createObjectURL and revokeObjectURL to put under webkitURL.
https://bugs.webkit.org/show_bug.cgi?id=52257
Change all related test scripts and results to account for this change.
* fast/dom/Window/script-tests/window-property-descriptors.js:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/Window/window-properties.html:
* fast/dom/script-tests/prototype-inheritance-2.js:
* fast/dom/script-tests/prototype-inheritance.js:
* fast/files/apply-blob-url-to-img.html:
* fast/files/apply-blob-url-to-xhr.html:
* fast/files/create-blob-url-crash.html:
* fast/files/revoke-blob-url.html:
* fast/files/workers/resources/worker-apply-blob-url-to-xhr.js:
(onmessage):
* platform/qt/fast/dom/Window/window-properties-expected.txt:
2011-01-13 Emil Eklund <eae@chromium.org>
 
Reviewed by Dimitri Glazkov.
......
......@@ -41,7 +41,9 @@ var __skip__ = {
"FileReader" : 1,
"ondeviceorientation" : 1,
// Ignore this property because it only appears in debug builds and not in release.
"jscprint" : 1
"jscprint" : 1,
// Ignore this property because it is not supported in all platforms.
"webkitURL" : 1,
};
var windowPropertyNames = Object.getOwnPropertyNames(window)
......@@ -66,9 +68,6 @@ for (var name in protoPropertySet)
protoPropertyNames.sort();
for (var i = 0; i < protoPropertyNames.length; ++i) {
// Ignore these properties because they do not exist in all implementations.
if (protoPropertyNames[i] == "createObjectURL" || protoPropertyNames[i] == "revokeObjectURL")
continue;
if (protoPropertyNames[i] == "constructor")
continue;
shouldBeUndefined("Object.getOwnPropertyDescriptor(window, '" + protoPropertyNames[i] + "')");
......
......@@ -2201,7 +2201,6 @@ window.constructor.prototype.clearInterval [function]
window.constructor.prototype.clearTimeout [function]
window.constructor.prototype.close [function]
window.constructor.prototype.confirm [function]
window.constructor.prototype.createObjectURL [function]
window.constructor.prototype.dispatchEvent [function]
window.constructor.prototype.find [function]
window.constructor.prototype.focus [function]
......@@ -2220,7 +2219,6 @@ window.constructor.prototype.releaseEvents [function]
window.constructor.prototype.removeEventListener [function]
window.constructor.prototype.resizeBy [function]
window.constructor.prototype.resizeTo [function]
window.constructor.prototype.revokeObjectURL [function]
window.constructor.prototype.scroll [function]
window.constructor.prototype.scrollBy [function]
window.constructor.prototype.scrollTo [function]
......
......@@ -89,8 +89,7 @@ var __skip__ = {
"window.DeviceMotionEvent" : 1,
"window.ondevicemotion" : 1,
"window.performance" : 1,
"window.createObjectURL" : 1,
"window.revokeObjectURL" : 1,
"window.webkitURL" : 1,
// showModalDialog is not implemented on all platforms in DumpRenderTree.
"window.showModalDialog" : 1,
......
......@@ -18,6 +18,8 @@ var skippedProperties = [
"prototype",
// Skip Geolocation until it is supported on most platforms.
"geolocation",
// Skip webkitURL until it is supported on most platforms.
"webkitURL",
];
var skippedPropertiesSet = {};
......
......@@ -21,7 +21,7 @@ var skippedProperties = [
"FileError", "FileReader", "requestFileSystem",
"indexedDB", "IDBKeyRange", "IDBCursor", "IDBDatabase", "IDBDatabaseError", "IDBDatabaseException", "IDBErrorEvent", "IDBEvent", "IDBFactory", "IDBIndex", "IDBObjectStore", "IDBRequest", "IDBSuccessEvent", "IDBTransaction",
"showModalDialog",
"createObjectURL", "revokeObjectURL",
"webkitURL",
"DeviceOrientationEvent",
"DeviceMotionEvent",
"TEMPORARY", "PERSISTENT",
......
......@@ -17,7 +17,7 @@ function onInputFileChange()
var img = document.getElementById('imgToReplace');
log("Old image: " + img.width + " x " + img.height);
img.onload = onImgLoad;
img.src = window.createObjectURL(file);
img.src = window.webkitURL.createObjectURL(file);
}
function onImgLoad()
......
......@@ -26,7 +26,7 @@ function sendXMLHttpRequest(method, url)
function onInputFileChange()
{
var file = document.getElementById("file").files[0];
var fileURL = window.createObjectURL(file);
var fileURL = window.webkitURL.createObjectURL(file);
log("Test that XMLHttpRequest GET succeeds.");
sendXMLHttpRequest("GET", fileURL);
......@@ -35,7 +35,7 @@ function onInputFileChange()
sendXMLHttpRequest("POST", fileURL);
log("Test that XMLHttpRequest GET fails after the blob URL is revoked.");
window.revokeObjectURL(fileURL);
window.webkitURL.revokeObjectURL(fileURL);
sendXMLHttpRequest("GET", fileURL);
log("DONE");
......
......@@ -10,7 +10,7 @@ function log(message)
function test()
{
log("Test that createObjectURL with no argument should not cause crash.");
var url = createObjectURL();
var url = webkitURL.createObjectURL();
log(url == undefined ? "PASS" : "FAIL");
log("DONE");
......
......@@ -10,19 +10,19 @@ function log(message)
function test()
{
log("Test calling revokeObjectURL with no argument.");
var url = revokeObjectURL();
var url = webkitURL.revokeObjectURL();
log(url == undefined ? "PASS" : "FAIL");
log("Test calling revokeObjectURL with empty URL.");
revokeObjectURL("");
webkitURL.revokeObjectURL("");
log("PASS");
log("Test calling revokeObjectURL with invalid URL.");
revokeObjectURL("[foo bar]");
webkitURL.revokeObjectURL("[foo bar]");
log("PASS");
log("Test calling revokeObjectURL with non-existent URL.");
revokeObjectURL("blob:non-existent");
webkitURL.revokeObjectURL("blob:non-existent");
log("PASS");
log("DONE");
......
......@@ -19,7 +19,7 @@ function sendXMLHttpRequest(method, url)
onmessage = function(event)
{
var file = event.data;
var fileURL = createObjectURL(file);
var fileURL = webkitURL.createObjectURL(file);
log("Test that XMLHttpRequest GET succeeds.");
sendXMLHttpRequest("GET", fileURL);
......
......@@ -2167,7 +2167,6 @@ window.constructor.prototype.clearInterval [function]
window.constructor.prototype.clearTimeout [function]
window.constructor.prototype.close [function]
window.constructor.prototype.confirm [function]
window.constructor.prototype.createObjectURL [function]
window.constructor.prototype.dispatchEvent [function]
window.constructor.prototype.find [function]
window.constructor.prototype.focus [function]
......@@ -2186,7 +2185,6 @@ window.constructor.prototype.releaseEvents [function]
window.constructor.prototype.removeEventListener [function]
window.constructor.prototype.resizeBy [function]
window.constructor.prototype.resizeTo [function]
window.constructor.prototype.revokeObjectURL [function]
window.constructor.prototype.scroll [function]
window.constructor.prototype.scrollBy [function]
window.constructor.prototype.scrollTo [function]
......
......@@ -159,6 +159,7 @@ GEN := \
$(intermediates)/html/JSDOMFormData.h \
$(intermediates)/html/JSDOMSettableTokenList.h \
$(intermediates)/html/JSDOMTokenList.h \
$(intermediates)/html/JSDOMURL.h \
$(intermediates)/html/JSDataGridColumn.h \
$(intermediates)/html/JSDataGridColumnList.h \
$(intermediates)/html/JSFile.h \
......
......@@ -140,6 +140,7 @@ GEN := \
$(intermediates)/bindings/V8BlobBuilder.h \
$(intermediates)/bindings/V8DOMTokenList.h \
$(intermediates)/bindings/V8DOMSettableTokenList.h \
$(intermediates)/bindings/V8DOMURL.h \
$(intermediates)/bindings/V8DataGridColumn.h \
$(intermediates)/bindings/V8DataGridColumnList.h \
$(intermediates)/bindings/V8File.h \
......
......@@ -273,6 +273,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
html/DOMFormData.cpp \
html/DOMSettableTokenList.cpp \
html/DOMTokenList.cpp \
html/DOMURL.cpp \
html/DateInputType.cpp \
html/DateTimeInputType.cpp \
html/DateTimeLocalInputType.cpp \
......
......@@ -198,6 +198,7 @@ SET(WebCore_IDL_FILES
html/DOMFormData.idl
html/DOMSettableTokenList.idl
html/DOMTokenList.idl
html/DOMURL.idl
html/HTMLAllCollection.idl
html/HTMLAnchorElement.idl
html/HTMLAppletElement.idl
......@@ -996,6 +997,7 @@ SET(WebCore_SOURCES
html/DOMFormData.cpp
html/DOMSettableTokenList.cpp
html/DOMTokenList.cpp
html/DOMURL.cpp
html/DataGridColumn.cpp
html/DataGridColumnList.cpp
html/DateComponents.cpp
......
2011-01-13 Jian Li <jianli@chromium.org>
Reviewed by Darin Fisher.
Change createObjectURL and revokeObjectURL to put under webkitURL.
https://bugs.webkit.org/show_bug.cgi?id=52257
Note that we add "webkit" vendor prefix to URL that is introduced in
the latest File API spec.
For the time being, we implement webkitURL as a readonly attribute
instead of a constructor so that we will not expose prototype property,
as required by the spec.
* Android.derived.jscbindings.mk:
* Android.derived.v8bindings.mk:
* Android.mk:
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* html/DOMURL.cpp: Added.
* html/DOMURL.h: Added.
* html/DOMURL.idl: Added.
* inspector/front-end/NetworkPanel.js:
* inspector/front-end/utilities.js:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::webkitURL):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::webkitURL):
* workers/WorkerContext.h:
* workers/WorkerContext.idl:
2011-01-13 Emil Eklund <eae@chromium.org>
 
Reviewed by Dimitri Glazkov.
......
......@@ -94,6 +94,7 @@
#include "JSDOMStringList.cpp"
#include "JSDOMStringMap.cpp"
#include "JSDOMTokenList.cpp"
#include "JSDOMURL.cpp"
#include "JSDOMWindow.cpp"
#include "JSElement.cpp"
#include "JSEntity.cpp"
......
......@@ -147,6 +147,7 @@ DOM_CLASSES = \
DOMStringMap \
DOMSettableTokenList \
DOMTokenList \
DOMURL \
DOMWindow \
Database \
DatabaseCallback \
......
......@@ -237,6 +237,8 @@ webcore_built_sources += \
DerivedSources/WebCore/JSDOMStringMap.h \
DerivedSources/WebCore/JSDOMTokenList.cpp \
DerivedSources/WebCore/JSDOMTokenList.h \
DerivedSources/WebCore/JSDOMURL.cpp \
DerivedSources/WebCore/JSDOMURL.h \
DerivedSources/WebCore/JSDOMWindow.cpp \
DerivedSources/WebCore/JSDOMWindow.h \
DerivedSources/WebCore/JSElement.cpp \
......@@ -1618,6 +1620,8 @@ webcore_sources += \
Source/WebCore/html/DOMDataGridDataSource.h \
Source/WebCore/html/DOMFormData.cpp \
Source/WebCore/html/DOMFormData.h \
Source/WebCore/html/DOMURL.cpp \
Source/WebCore/html/DOMURL.h \
Source/WebCore/html/EmailInputType.cpp \
Source/WebCore/html/EmailInputType.h \
Source/WebCore/html/FileInputType.cpp \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment