mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Fix for bug 743666 (Add back deprecated XHR.onuploadprogress). r=bzbarsky
This commit is contained in:
parent
ad056ade92
commit
48970d949a
@ -48,3 +48,4 @@ DEPRECATED_OPERATION(DOMExceptionCode)
|
||||
DEPRECATED_OPERATION(NoExposedProps)
|
||||
DEPRECATED_OPERATION(MutationEvent)
|
||||
DEPRECATED_OPERATION(MozSlice)
|
||||
DEPRECATED_OPERATION(Onuploadprogress)
|
||||
|
@ -246,6 +246,24 @@ public:
|
||||
|
||||
// event handler
|
||||
IMPL_EVENT_HANDLER(readystatechange, Readystatechange)
|
||||
JSObject* GetOnuploadprogress(JSContext* /* unused */)
|
||||
{
|
||||
nsIDocument* doc = GetOwner() ? GetOwner()->GetExtantDoc() : NULL;
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eOnuploadprogress);
|
||||
}
|
||||
return GetListenerAsJSObject(mOnUploadProgressListener);
|
||||
}
|
||||
void SetOnuploadprogress(JSContext* aCx, JSObject* aCallback,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsIDocument* doc = GetOwner() ? GetOwner()->GetExtantDoc() : NULL;
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eOnuploadprogress);
|
||||
}
|
||||
aRv = SetJSObjectListener(aCx, NS_LITERAL_STRING("uploadprogress"),
|
||||
mOnUploadProgressListener, aCallback);
|
||||
}
|
||||
|
||||
// states
|
||||
uint16_t GetReadyState();
|
||||
|
@ -549,6 +549,7 @@ _TEST_FILES2 = \
|
||||
test_bug433662.html \
|
||||
test_bug749367.html \
|
||||
test_bug753278.html \
|
||||
test_XHR_onuploadprogress.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
41
content/base/test/test_XHR_onuploadprogress.html
Normal file
41
content/base/test/test_XHR_onuploadprogress.html
Normal file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=743666
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 743666</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=743666">Mozilla Bug 743666</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 743666 **/
|
||||
|
||||
var called = false;
|
||||
function uploadprogress()
|
||||
{
|
||||
called = true;
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onuploadprogress = uploadprogress;
|
||||
var event = document.createEvent("ProgressEvent");
|
||||
event.initProgressEvent("uploadprogress", false, false, false, false, 0);
|
||||
xhr.dispatchEvent(event);
|
||||
ok(called,
|
||||
"XMLHttpRequest.onuploadprogress sets uploadprogress event listener");
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -232,7 +232,7 @@ DOMInterfaces = {
|
||||
'multipart', 'channel', 'upload', 'status'
|
||||
],
|
||||
'getterOnly': [
|
||||
'responseType', 'timeout', 'onreadystatechange'
|
||||
'responseType', 'timeout', 'onreadystatechange', 'onuploadprogress'
|
||||
]
|
||||
},
|
||||
# XXXbz need a JSContext for send() and sendAsBinary because of
|
||||
|
@ -125,3 +125,4 @@ NoExposedPropsWarning=Exposing chrome JS objects to content without __exposedPro
|
||||
MutationEventWarning=Use of Mutation Events is deprecated. Use MutationObserver instead.
|
||||
# LOCALIZATION NOTE: Do not translate "Blob", "mozSlice", or "slice"
|
||||
MozSliceWarning=Use of mozSlice on the Blob object is deprecated. Use slice instead.
|
||||
OnuploadprogressWarning=Use of XMLHttpRequest's onuploadprogress attribute is deprecated.
|
||||
|
@ -79,4 +79,5 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
[ChromeOnly] readonly attribute MozChannel channel;
|
||||
void sendAsBinary(DOMString body);
|
||||
any getInterface(IID iid);
|
||||
[TreatNonCallableAsNull] attribute Function? onuploadprogress;
|
||||
};
|
||||
|
@ -95,6 +95,18 @@ public:
|
||||
|
||||
#undef IMPL_GETTER_AND_SETTER
|
||||
|
||||
JSObject*
|
||||
GetOnuploadprogress(JSContext* /* unused */, ErrorResult& aRv)
|
||||
{
|
||||
aRv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NULL;
|
||||
}
|
||||
void
|
||||
SetOnuploadprogress(JSContext* /* unused */, JSObject* aListener, ErrorResult& aRv)
|
||||
{
|
||||
aRv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
GetReadyState() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user