Commit 48970d94 authored by Peter Van der Beken's avatar Peter Van der Beken
Browse files

Fix for bug 743666 (Add back deprecated XHR.onuploadprogress). r=bzbarsky

parent ad056ade
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,3 +48,4 @@ DEPRECATED_OPERATION(DOMExceptionCode)
DEPRECATED_OPERATION(NoExposedProps)
DEPRECATED_OPERATION(MutationEvent)
DEPRECATED_OPERATION(MozSlice)
DEPRECATED_OPERATION(Onuploadprogress)
+18 −0
Original line number Diff line number Diff line
@@ -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();
+1 −0
Original line number Diff line number Diff line
@@ -549,6 +549,7 @@ _TEST_FILES2 = \
		test_bug433662.html \
		test_bug749367.html \
		test_bug753278.html \
		test_XHR_onuploadprogress.html \
		$(NULL)

_CHROME_FILES =	\
+41 −0
Original line number Diff line number Diff line
<!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>
+1 −1
Original line number Diff line number Diff line
@@ -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
Loading