mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1011815 part 2. Make DOMRequest.error be a DOMError. r=smaug
This commit is contained in:
parent
e7f072601f
commit
afa4652345
@ -17,6 +17,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMError)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMError)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMError)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(DOMError)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include "nsString.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#define DOMERROR_IID \
|
||||
{ 0x220cb63f, 0xa37d, 0x4ba4, \
|
||||
{ 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } }
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
@ -32,6 +36,8 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError)
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID)
|
||||
|
||||
// aWindow can be null if this DOMError is not associated with a particular
|
||||
// window.
|
||||
|
||||
@ -75,6 +81,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DOMError, DOMERROR_IID)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "DOMCursor.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
using mozilla::dom::DOMError;
|
||||
using mozilla::dom::DOMRequest;
|
||||
using mozilla::dom::DOMRequestService;
|
||||
using mozilla::dom::DOMCursor;
|
||||
@ -136,7 +137,7 @@ DOMRequest::FireError(nsresult aError)
|
||||
}
|
||||
|
||||
void
|
||||
DOMRequest::FireDetailedError(nsISupports* aError)
|
||||
DOMRequest::FireDetailedError(DOMError* aError)
|
||||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
@ -225,7 +226,9 @@ DOMRequestService::FireDetailedError(nsIDOMDOMRequest* aRequest,
|
||||
nsISupports* aError)
|
||||
{
|
||||
NS_ENSURE_STATE(aRequest);
|
||||
static_cast<DOMRequest*>(aRequest)->FireDetailedError(aError);
|
||||
nsCOMPtr<DOMError> err = do_QueryInterface(aError);
|
||||
NS_ENSURE_STATE(err);
|
||||
static_cast<DOMRequest*>(aRequest)->FireDetailedError(err);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsIDOMDOMRequest.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/DOMRequestBinding.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
@ -22,7 +23,7 @@ class DOMRequest : public DOMEventTargetHelper,
|
||||
{
|
||||
protected:
|
||||
JS::Heap<JS::Value> mResult;
|
||||
nsCOMPtr<nsISupports> mError;
|
||||
nsRefPtr<DOMError> mError;
|
||||
bool mDone;
|
||||
|
||||
public:
|
||||
@ -55,7 +56,7 @@ public:
|
||||
return mResult;
|
||||
}
|
||||
|
||||
nsISupports* GetError() const
|
||||
DOMError* GetError() const
|
||||
{
|
||||
NS_ASSERTION(mDone || !mError,
|
||||
"Error should be null when pending");
|
||||
@ -69,7 +70,7 @@ public:
|
||||
void FireSuccess(JS::Handle<JS::Value> aResult);
|
||||
void FireError(const nsAString& aError);
|
||||
void FireError(nsresult aError);
|
||||
void FireDetailedError(nsISupports* aError);
|
||||
void FireDetailedError(DOMError* aError);
|
||||
|
||||
DOMRequest(nsPIDOMWindow* aWindow);
|
||||
|
||||
|
@ -3,15 +3,13 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
interface nsISupports;
|
||||
|
||||
enum DOMRequestReadyState { "pending", "done" };
|
||||
|
||||
interface DOMRequest : EventTarget {
|
||||
readonly attribute DOMRequestReadyState readyState;
|
||||
|
||||
readonly attribute any result;
|
||||
readonly attribute nsISupports? error;
|
||||
readonly attribute DOMError? error;
|
||||
|
||||
attribute EventHandler onsuccess;
|
||||
attribute EventHandler onerror;
|
||||
|
Loading…
Reference in New Issue
Block a user