mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 870856 - Convert DOMError to WebIDL. r=Ms2ger, r=bz
This commit is contained in:
parent
ddac9471c0
commit
38fc5d8909
@ -7,9 +7,8 @@
|
||||
|
||||
interface nsIDOMEventListener;
|
||||
interface nsIDOMBlob;
|
||||
interface nsIDOMDOMError;
|
||||
|
||||
[scriptable, builtinclass, uuid(81a8d00b-2982-44f6-aecf-faac0d0819d6)]
|
||||
[scriptable, builtinclass, uuid(39ea2c73-7711-4cea-9f73-3166c24dfa69)]
|
||||
interface nsIDOMFileReader : nsIDOMEventTarget
|
||||
{
|
||||
[implicit_jscontext]
|
||||
@ -27,7 +26,9 @@ interface nsIDOMFileReader : nsIDOMEventTarget
|
||||
|
||||
[implicit_jscontext]
|
||||
readonly attribute jsval result;
|
||||
readonly attribute nsIDOMDOMError error;
|
||||
|
||||
// This is a DOMError
|
||||
readonly attribute nsISupports error;
|
||||
|
||||
[implicit_jscontext] attribute jsval onloadstart;
|
||||
[implicit_jscontext] attribute jsval onprogress;
|
||||
|
@ -85,13 +85,13 @@ FileIOObject::DispatchError(nsresult rv, nsAString& finalEvent)
|
||||
// Set the status attribute, and dispatch the error event
|
||||
switch (rv) {
|
||||
case NS_ERROR_FILE_NOT_FOUND:
|
||||
mError = DOMError::CreateWithName(NS_LITERAL_STRING("NotFoundError"));
|
||||
mError = new DOMError(GetOwner(), NS_LITERAL_STRING("NotFoundError"));
|
||||
break;
|
||||
case NS_ERROR_FILE_ACCESS_DENIED:
|
||||
mError = DOMError::CreateWithName(NS_LITERAL_STRING("SecurityError"));
|
||||
mError = new DOMError(GetOwner(), NS_LITERAL_STRING("SecurityError"));
|
||||
break;
|
||||
default:
|
||||
mError = DOMError::CreateWithName(NS_LITERAL_STRING("NotReadableError"));
|
||||
mError = new DOMError(GetOwner(), NS_LITERAL_STRING("NotReadableError"));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ FileIOObject::Abort(ErrorResult& aRv)
|
||||
mReadyState = 2; // There are DONE constants on multiple interfaces,
|
||||
// but they all have value 2.
|
||||
// XXX The spec doesn't say this
|
||||
mError = DOMError::CreateWithName(NS_LITERAL_STRING("AbortError"));
|
||||
mError = new DOMError(GetOwner(), NS_LITERAL_STRING("AbortError"));
|
||||
|
||||
nsString finalEvent;
|
||||
DoAbort(finalEvent);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
{
|
||||
return mReadyState;
|
||||
}
|
||||
nsIDOMDOMError* GetError() const
|
||||
DOMError* GetError() const
|
||||
{
|
||||
return mError;
|
||||
}
|
||||
@ -92,7 +92,7 @@ protected:
|
||||
bool mProgressEventWasDelayed;
|
||||
bool mTimerIsActive;
|
||||
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
nsRefPtr<DOMError> mError;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
|
||||
uint16_t mReadyState;
|
||||
|
@ -212,7 +212,7 @@ nsDOMFileReader::GetResult(JSContext* aCx, JS::Value* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMFileReader::GetError(nsIDOMDOMError** aError)
|
||||
nsDOMFileReader::GetError(nsISupports** aError)
|
||||
{
|
||||
NS_IF_ADDREF(*aError = GetError());
|
||||
return NS_OK;
|
||||
|
@ -285,36 +285,6 @@ WebappsRegistry.prototype = {
|
||||
classDescription: "Webapps Registry"})
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIDOMDOMError object
|
||||
*/
|
||||
function createDOMError(aError) {
|
||||
let error = Cc["@mozilla.org/dom-error;1"]
|
||||
.createInstance(Ci.nsIDOMDOMError);
|
||||
error.wrappedJSObject.init(aError);
|
||||
return error;
|
||||
}
|
||||
|
||||
function DOMError() {
|
||||
this.wrappedJSObject = this;
|
||||
}
|
||||
|
||||
DOMError.prototype = {
|
||||
init: function domerror_init(aError) {
|
||||
this.name = aError;
|
||||
},
|
||||
|
||||
classID: Components.ID("{dcc1d5b7-43d8-4740-9244-b3d8db0f503d}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMDOMError]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{dcc1d5b7-43d8-4740-9244-b3d8db0f503d}"),
|
||||
contractID: "@mozilla.org/dom-error;1",
|
||||
interfaces: [Ci.nsIDOMDOMError],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "DOMError object"})
|
||||
}
|
||||
|
||||
/**
|
||||
* mozIDOMApplication object
|
||||
*/
|
||||
@ -459,7 +429,7 @@ WebappsApplication.prototype = {
|
||||
},
|
||||
|
||||
get downloadError() {
|
||||
return createDOMError(this._downloadError);
|
||||
return new this._window.DOMError(this._downloadError || '');
|
||||
},
|
||||
|
||||
download: function() {
|
||||
@ -786,5 +756,4 @@ WebappsApplicationMgmt.prototype = {
|
||||
}
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebappsRegistry,
|
||||
WebappsApplication,
|
||||
DOMError]);
|
||||
WebappsApplication]);
|
||||
|
@ -4,50 +4,72 @@
|
||||
* 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/. */
|
||||
|
||||
#include "DOMError.h"
|
||||
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/DOMErrorBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMException.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
using mozilla::dom::DOMError;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace {
|
||||
|
||||
struct NameMap
|
||||
{
|
||||
uint16_t code;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// static
|
||||
already_AddRefed<nsIDOMDOMError>
|
||||
DOMError::CreateForNSResult(nsresult aRv)
|
||||
{
|
||||
const char* name;
|
||||
const char* message;
|
||||
aRv = NS_GetNameAndMessageForDOMNSResult(aRv, &name, &message);
|
||||
if (NS_FAILED(aRv) || !name) {
|
||||
return nullptr;
|
||||
}
|
||||
return CreateWithName(NS_ConvertASCIItoUTF16(name));
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(DOMError)
|
||||
NS_IMPL_RELEASE(DOMError)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(DOMError)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMError)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMError)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(DOMError, mWindow)
|
||||
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(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
DOMCI_DATA(DOMError, DOMError)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMError::GetName(nsAString& aName)
|
||||
DOMError::DOMError(nsPIDOMWindow* aWindow, nsresult aValue)
|
||||
: mWindow(aWindow)
|
||||
{
|
||||
aName = mName;
|
||||
return NS_OK;
|
||||
const char *name, *message;
|
||||
NS_GetNameAndMessageForDOMNSResult(aValue, &name, &message);
|
||||
|
||||
mName = NS_ConvertASCIItoUTF16(name);
|
||||
mMessage = NS_ConvertASCIItoUTF16(message);
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName)
|
||||
: mWindow(aWindow)
|
||||
, mName(aName)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
||||
const nsAString& aMessage)
|
||||
: mWindow(aWindow)
|
||||
, mName(aName)
|
||||
, mMessage(aMessage)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
DOMError::~DOMError()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject*
|
||||
DOMError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return DOMErrorBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<DOMError>
|
||||
DOMError::Constructor(const GlobalObject& aGlobal, const nsAString& aName,
|
||||
const nsAString& aMessage, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
|
||||
|
||||
// Window is null for chrome code.
|
||||
|
||||
nsRefPtr<DOMError> ret = new DOMError(window, aName, aMessage);
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -7,39 +7,63 @@
|
||||
#ifndef mozilla_dom_domerror_h__
|
||||
#define mozilla_dom_domerror_h__
|
||||
|
||||
#include "nsIDOMDOMError.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsStringGlue.h"
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMError : public nsIDOMDOMError
|
||||
class GlobalObject;
|
||||
|
||||
class DOMError : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsString mName;
|
||||
nsString mMessage;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMDOMERROR
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError)
|
||||
|
||||
static already_AddRefed<nsIDOMDOMError>
|
||||
CreateForNSResult(nsresult rv);
|
||||
// aWindow can be null if this DOMError is not associated with a particular
|
||||
// window.
|
||||
|
||||
static already_AddRefed<nsIDOMDOMError>
|
||||
CreateWithName(const nsAString& aName)
|
||||
DOMError(nsPIDOMWindow* aWindow, nsresult aValue);
|
||||
|
||||
DOMError(nsPIDOMWindow* aWindow, const nsAString& aName);
|
||||
|
||||
DOMError(nsPIDOMWindow* aWindow, const nsAString& aName,
|
||||
const nsAString& aMessage);
|
||||
|
||||
virtual ~DOMError();
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
{
|
||||
nsCOMPtr<nsIDOMDOMError> error = new DOMError(aName);
|
||||
return error.forget();
|
||||
return mWindow;
|
||||
}
|
||||
|
||||
protected:
|
||||
DOMError(const nsAString& aName)
|
||||
: mName(aName)
|
||||
{ }
|
||||
virtual JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
virtual ~DOMError()
|
||||
{ }
|
||||
static already_AddRefed<DOMError>
|
||||
Constructor(const GlobalObject& global, const nsAString& name,
|
||||
const nsAString& message, ErrorResult& aRv);
|
||||
|
||||
void GetName(nsString& aRetval) const
|
||||
{
|
||||
aRetval = mName;
|
||||
}
|
||||
|
||||
void GetMessage(nsString& aRetval) const
|
||||
{
|
||||
aRetval = mMessage;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -108,7 +108,7 @@ DOMRequest::GetResult(JS::Value* aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMRequest::GetError(nsIDOMDOMError** aError)
|
||||
DOMRequest::GetError(nsISupports** aError)
|
||||
{
|
||||
NS_IF_ADDREF(*aError = GetError());
|
||||
return NS_OK;
|
||||
@ -138,7 +138,7 @@ DOMRequest::FireError(const nsAString& aError)
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
|
||||
mDone = true;
|
||||
mError = DOMError::CreateWithName(aError);
|
||||
mError = new DOMError(GetOwner(), aError);
|
||||
|
||||
FireEvent(NS_LITERAL_STRING("error"), true, true);
|
||||
}
|
||||
@ -151,7 +151,7 @@ DOMRequest::FireError(nsresult aError)
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
|
||||
mDone = true;
|
||||
mError = DOMError::CreateForNSResult(aError);
|
||||
mError = new DOMError(GetOwner(), aError);
|
||||
|
||||
FireEvent(NS_LITERAL_STRING("error"), true, true);
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
#define mozilla_dom_domrequest_h__
|
||||
|
||||
#include "nsIDOMDOMRequest.h"
|
||||
#include "nsIDOMDOMError.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/DOMRequestBinding.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
@ -23,7 +23,7 @@ class DOMRequest : public nsDOMEventTargetHelper,
|
||||
{
|
||||
protected:
|
||||
JS::Value mResult;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
nsRefPtr<DOMError> mError;
|
||||
bool mDone;
|
||||
bool mRooted;
|
||||
|
||||
@ -58,7 +58,7 @@ public:
|
||||
return mResult;
|
||||
}
|
||||
|
||||
nsIDOMDOMError* GetError() const
|
||||
DOMError* GetError() const
|
||||
{
|
||||
NS_ASSERTION(mDone || !mError,
|
||||
"Error should be null when pending");
|
||||
|
@ -8,7 +8,6 @@ TEST_DIRS += ['test']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMDOMCursor.idl',
|
||||
'nsIDOMDOMError.idl',
|
||||
'nsIDOMDOMRequest.idl',
|
||||
'nsIEntropyCollector.idl',
|
||||
'nsIScriptChannel.idl',
|
||||
|
@ -318,7 +318,6 @@ using mozilla::dom::workers::ResolveWorkerClasses;
|
||||
#include "DOMCameraManager.h"
|
||||
#include "DOMCameraControl.h"
|
||||
#include "DOMCameraCapabilities.h"
|
||||
#include "DOMError.h"
|
||||
#include "nsIOpenWindowEventDetail.h"
|
||||
#include "nsIAsyncScrollEventDetail.h"
|
||||
#include "nsIDOMGlobalObjectConstructor.h"
|
||||
@ -893,9 +892,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(DOMError, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(OpenWindowEventDetail, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(AsyncScrollEventDetail, nsDOMGenericSH,
|
||||
@ -2267,10 +2263,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DOMError, nsIDOMDOMError)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMError)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(OpenWindowEventDetail, nsIOpenWindowEventDetail)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIOpenWindowEventDetail)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -228,7 +228,6 @@ DOMCI_CLASS(CameraManager)
|
||||
DOMCI_CLASS(CameraControl)
|
||||
DOMCI_CLASS(CameraCapabilities)
|
||||
|
||||
DOMCI_CLASS(DOMError)
|
||||
DOMCI_CLASS(OpenWindowEventDetail)
|
||||
DOMCI_CLASS(AsyncScrollEventDetail)
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(e4e28307-d409-4cf7-93cd-6ea8e889f87a)]
|
||||
interface nsIDOMDOMError : nsISupports
|
||||
{
|
||||
readonly attribute DOMString name;
|
||||
};
|
@ -6,18 +6,19 @@
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
interface nsIDOMDOMError;
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMDOMCursor;
|
||||
interface nsICursorContinueCallback;
|
||||
|
||||
[scriptable, builtinclass, uuid(e18fdde5-35b0-46df-8522-f88adf7698f3)]
|
||||
[scriptable, builtinclass, uuid(d4c7372a-661c-4798-9a13-af48128609e9)]
|
||||
interface nsIDOMDOMRequest : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute DOMString readyState; // "pending" or "done"
|
||||
|
||||
readonly attribute jsval result;
|
||||
readonly attribute nsIDOMDOMError error;
|
||||
|
||||
// DOMError
|
||||
readonly attribute nsISupports error;
|
||||
|
||||
[implicit_jscontext] attribute jsval onsuccess;
|
||||
[implicit_jscontext] attribute jsval onerror;
|
||||
|
@ -30,6 +30,7 @@ MOCHITEST_FILES = \
|
||||
test_named_frames.html \
|
||||
test_Image_constructor.html \
|
||||
test_setting_opener.html \
|
||||
test_error.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
|
44
dom/base/test/test_error.html
Normal file
44
dom/base/test/test_error.html
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=869013
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 869013</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=869013">Mozilla Bug 869013</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe name="x" id="x"></iframe>
|
||||
<iframe name="y" id="y"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 869013 **/
|
||||
var a = new DOMError('name');
|
||||
ok(a, "DOMError created with name: " + a.name + " and message: " + a.message);
|
||||
is(a.name, "name", "Name is correct");
|
||||
is(a.message, "", "Message is correct");
|
||||
|
||||
a = new DOMError('name1', 'message1');
|
||||
ok(a, "DOMError created with name: " + a.name + " and message: " + a.message);
|
||||
is(a.name, "name1", "Name is correct");
|
||||
is(a.message, "message1", "Message is correct");
|
||||
|
||||
try {
|
||||
a = new DOMError();
|
||||
ok(false, "DOMError should throw if there are not params");
|
||||
} catch(e) {
|
||||
ok(true, "DOMError should throw if there are not params");
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1550,7 +1550,6 @@ addExternalIface('Counter')
|
||||
addExternalIface('CSSRule')
|
||||
addExternalIface('DeviceAcceleration', headerFile='nsIDOMDeviceMotionEvent.h', notflattened=True)
|
||||
addExternalIface('DeviceRotationRate', headerFile='nsIDOMDeviceMotionEvent.h', notflattened=True)
|
||||
addExternalIface('DOMError')
|
||||
addExternalIface('CSSRuleList')
|
||||
addExternalIface('DOMStringList')
|
||||
addExternalIface('RTCDataChannel', nativeType='nsIDOMDataChannel')
|
||||
|
@ -29,11 +29,6 @@
|
||||
"DOMException exception: constant INVALID_NODE_TYPE_ERR on exception interface prototype object": true,
|
||||
"DOMException exception: constant DATA_CLONE_ERR on exception interface prototype object": true,
|
||||
"DOMException exception: field code on exception interface prototype object": true,
|
||||
"DOMError interface: existence and properties of interface object": true,
|
||||
"DOMError interface constructor": true,
|
||||
"DOMError interface: existence and properties of interface prototype object": true,
|
||||
"DOMError interface: existence and properties of interface prototype object's \"constructor\" property": true,
|
||||
"DOMError interface: attribute name": true,
|
||||
"Event interface: document.createEvent(\"Event\") must have own property \"isTrusted\"": true,
|
||||
"Event interface: document.createEvent(\"Event\") must inherit property \"timeStamp\" with the proper type (15)": true,
|
||||
"Event interface: new Event(\"foo\") must have own property \"isTrusted\"": true,
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "IDBEvents.h"
|
||||
#include "IDBFactory.h"
|
||||
#include "IDBTransaction.h"
|
||||
#include "DOMError.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -164,7 +163,7 @@ IDBRequest::SetError(nsresult aRv)
|
||||
NS_ASSERTION(!mError, "Already have an error?");
|
||||
|
||||
mHaveResultOrErrorCode = true;
|
||||
mError = DOMError::CreateForNSResult(aRv);
|
||||
mError = new mozilla::dom::DOMError(GetOwner(), aRv);
|
||||
mErrorCode = aRv;
|
||||
|
||||
mResultVal = JSVAL_VOID;
|
||||
@ -278,17 +277,26 @@ IDBRequest::GetResult(jsval* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBRequest::GetError(nsIDOMDOMError** aError)
|
||||
mozilla::dom::DOMError*
|
||||
IDBRequest::GetError(mozilla::ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
if (!mHaveResultOrErrorCode) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aError = mError);
|
||||
return NS_OK;
|
||||
return mError;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBRequest::GetError(nsISupports** aError)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aError = GetError(rv);
|
||||
NS_IF_ADDREF(*aError);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBRequest, IDBWrapperCache)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "nsIIDBOpenDBRequest.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/indexedDB/IDBWrapperCache.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
|
||||
class nsIScriptContext;
|
||||
class nsPIDOMWindow;
|
||||
@ -64,6 +65,8 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
DOMError* GetError(ErrorResult& aRv);
|
||||
|
||||
JSContext* GetJSContext();
|
||||
|
||||
void
|
||||
@ -106,7 +109,7 @@ protected:
|
||||
nsRefPtr<IDBTransaction> mTransaction;
|
||||
|
||||
jsval mResultVal;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
nsRefPtr<mozilla::dom::DOMError> mError;
|
||||
IndexedDBRequestParentBase* mActorParent;
|
||||
nsString mFilename;
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
@ -138,6 +141,11 @@ public:
|
||||
// nsIDOMEventTarget
|
||||
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
|
||||
|
||||
DOMError* GetError(ErrorResult& aRv)
|
||||
{
|
||||
return IDBRequest::GetError(aRv);
|
||||
}
|
||||
|
||||
IDBFactory*
|
||||
Factory() const
|
||||
{
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
#include "DOMError.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/storage.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -37,6 +36,7 @@
|
||||
|
||||
#define SAVEPOINT_NAME "savepoint"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
using mozilla::dom::quota::QuotaManager;
|
||||
|
||||
@ -515,11 +515,11 @@ IDBTransaction::ClearCreatedFileInfos()
|
||||
|
||||
nsresult
|
||||
IDBTransaction::AbortInternal(nsresult aAbortCode,
|
||||
already_AddRefed<nsIDOMDOMError> aError)
|
||||
already_AddRefed<DOMError> aError)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsCOMPtr<nsIDOMDOMError> error = aError;
|
||||
nsRefPtr<DOMError> error = aError;
|
||||
|
||||
if (IsFinished()) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||
@ -586,8 +586,8 @@ IDBTransaction::Abort(IDBRequest* aRequest)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(aRequest, "This is undesirable.");
|
||||
|
||||
nsCOMPtr<nsIDOMDOMError> error;
|
||||
aRequest->GetError(getter_AddRefs(error));
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMError> error = aRequest->GetError(rv);
|
||||
|
||||
return AbortInternal(aRequest->GetErrorCode(), error.forget());
|
||||
}
|
||||
@ -597,7 +597,8 @@ IDBTransaction::Abort(nsresult aErrorCode)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
return AbortInternal(aErrorCode, DOMError::CreateForNSResult(aErrorCode));
|
||||
nsRefPtr<DOMError> error = new DOMError(GetOwner(), aErrorCode);
|
||||
return AbortInternal(aErrorCode, error.forget());
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBTransaction,
|
||||
@ -665,7 +666,7 @@ IDBTransaction::GetMode(nsAString& aMode)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IDBTransaction::GetError(nsIDOMDOMError** aError)
|
||||
IDBTransaction::GetError(nsISupports** aError)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
@ -858,7 +859,7 @@ CommitHelper::Run()
|
||||
// programmatically, create one now.
|
||||
if (!mTransaction->mError &&
|
||||
mAbortCode != NS_ERROR_DOM_INDEXEDDB_ABORT_ERR) {
|
||||
mTransaction->mError = DOMError::CreateForNSResult(mAbortCode);
|
||||
mTransaction->mError = new DOMError(mTransaction->GetOwner(), mAbortCode);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "mozIStorageStatement.h"
|
||||
#include "mozIStorageFunction.h"
|
||||
#include "nsIIDBTransaction.h"
|
||||
#include "nsIDOMDOMError.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "nsIRunnable.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
@ -222,7 +222,8 @@ public:
|
||||
|
||||
private:
|
||||
nsresult
|
||||
AbortInternal(nsresult aAbortCode, already_AddRefed<nsIDOMDOMError> aError);
|
||||
AbortInternal(nsresult aAbortCode,
|
||||
already_AddRefed<mozilla::dom::DOMError> aError);
|
||||
|
||||
// Should only be called directly through IndexedDBDatabaseChild.
|
||||
static already_AddRefed<IDBTransaction>
|
||||
@ -239,7 +240,7 @@ private:
|
||||
|
||||
nsRefPtr<IDBDatabase> mDatabase;
|
||||
nsRefPtr<DatabaseInfo> mDatabaseInfo;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
nsRefPtr<DOMError> mError;
|
||||
nsTArray<nsString> mObjectStoreNames;
|
||||
ReadyState mReadyState;
|
||||
Mode mMode;
|
||||
|
@ -239,14 +239,15 @@ IndexedDatabaseManager::FireWindowOnError(nsPIDOMWindow* aOwner,
|
||||
IDBRequest* request = static_cast<IDBRequest*>(strongRequest.get());
|
||||
NS_ENSURE_TRUE(request, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIDOMDOMError> error;
|
||||
rv = request->GetError(getter_AddRefs(error));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult ret;
|
||||
nsRefPtr<DOMError> error = request->GetError(ret);
|
||||
if (ret.Failed()) {
|
||||
return ret.ErrorCode();
|
||||
}
|
||||
|
||||
nsString errorName;
|
||||
if (error) {
|
||||
rv = error->GetName(errorName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
error->GetName(errorName);
|
||||
}
|
||||
|
||||
nsScriptErrorEvent event(true, NS_LOAD_ERROR);
|
||||
|
@ -2420,10 +2420,10 @@ OpenDatabaseHelper::DispatchErrorEvent()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDOMError> error;
|
||||
DebugOnly<nsresult> rv =
|
||||
mOpenDBRequest->GetError(getter_AddRefs(error));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "This shouldn't be failing at this point!");
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMError> error = mOpenDBRequest->GetError(rv);
|
||||
|
||||
NS_ASSERTION(!rv.Failed(), "This shouldn't be failing at this point!");
|
||||
if (!error) {
|
||||
mOpenDBRequest->SetError(mResultCode);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDOMError;
|
||||
interface nsIDOMEventListener;
|
||||
interface nsIIDBTransaction;
|
||||
|
||||
@ -15,12 +14,13 @@ interface nsIIDBTransaction;
|
||||
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBRequest for more
|
||||
* information.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(006f39d6-342e-4935-a438-365611fd9491)]
|
||||
[scriptable, builtinclass, uuid(4d1e9ee3-4bd0-4c99-9e6a-19cb536ab6d4)]
|
||||
interface nsIIDBRequest : nsISupports
|
||||
{
|
||||
readonly attribute jsval result;
|
||||
|
||||
readonly attribute nsIDOMDOMError error;
|
||||
// This is a DOMError
|
||||
readonly attribute nsISupports error;
|
||||
|
||||
readonly attribute nsISupports source;
|
||||
|
||||
|
@ -11,14 +11,13 @@ interface nsIIDBObjectStore;
|
||||
interface nsIIDBRequest;
|
||||
interface nsIIDBDatabase;
|
||||
interface nsIDOMDOMStringList;
|
||||
interface nsIDOMDOMError;
|
||||
|
||||
/**
|
||||
* IDBDTransaction interface. See
|
||||
* http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction
|
||||
* for more information.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(3197172b-2f56-4837-9427-5e5d4b20a363)]
|
||||
[scriptable, builtinclass, uuid(e17e36f6-a7d8-40b7-82d4-b54847169834)]
|
||||
interface nsIIDBTransaction : nsISupports
|
||||
{
|
||||
readonly attribute nsIIDBDatabase db;
|
||||
@ -26,7 +25,8 @@ interface nsIIDBTransaction : nsISupports
|
||||
// "readonly", "readwrite" or "versionchange"
|
||||
readonly attribute DOMString mode;
|
||||
|
||||
readonly attribute nsIDOMDOMError error;
|
||||
// This is a DOMError
|
||||
readonly attribute nsISupports error;
|
||||
|
||||
readonly attribute nsIDOMDOMStringList objectStoreNames;
|
||||
|
||||
|
@ -6,9 +6,8 @@
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
|
||||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMDOMError;
|
||||
|
||||
[scriptable, uuid(d89870fe-5ba3-11e2-a5d2-cfa1d3f6e5f4)]
|
||||
[scriptable, uuid(d33ee8a0-00e4-4669-b55d-f77fbee1153d)]
|
||||
interface mozIDOMApplication : nsISupports
|
||||
{
|
||||
readonly attribute jsval manifest;
|
||||
@ -60,7 +59,8 @@ interface mozIDOMApplication : nsISupports
|
||||
readonly attribute boolean readyToApplyDownload;
|
||||
readonly attribute long downloadSize;
|
||||
|
||||
readonly attribute nsIDOMDOMError downloadError;
|
||||
// This is a DOMError
|
||||
readonly attribute nsISupports downloadError;
|
||||
|
||||
attribute nsIDOMEventListener ondownloadsuccess;
|
||||
attribute nsIDOMEventListener ondownloaderror;
|
||||
|
@ -40,11 +40,8 @@ const BUFFER_SIZE = 65536;
|
||||
// sub-classes DOMError. Bug 867872 has been filed to implement this and
|
||||
// contains a documented TCPError.webidl that maps all the error codes we use in
|
||||
// this file to slightly more readable explanations.
|
||||
function createTCPError(aErrorName, aErrorType) {
|
||||
let error = Cc["@mozilla.org/dom-error;1"]
|
||||
.createInstance(Ci.nsIDOMDOMError);
|
||||
error.wrappedJSObject.init(aErrorName);
|
||||
return error;
|
||||
function createTCPError(aWindow, aErrorName, aErrorType) {
|
||||
return new (aWindow ? aWindow.DOMError : DOMError)(aErrorName);
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +269,7 @@ TCPSocket.prototype = {
|
||||
callListenerError: function ts_callListenerError(type, name) {
|
||||
// XXX we're not really using TCPError at this time, so there's only a name
|
||||
// attribute to pass.
|
||||
this.callListener(type, createTCPError(name));
|
||||
this.callListener(type, createTCPError(this.useWin, name));
|
||||
},
|
||||
|
||||
callListenerData: function ts_callListenerString(type, data) {
|
||||
@ -635,7 +632,7 @@ TCPSocket.prototype = {
|
||||
break;
|
||||
}
|
||||
}
|
||||
let err = createTCPError(errName, errType);
|
||||
let err = createTCPError(this.useWin, errName, errType);
|
||||
this.callListener("error", err);
|
||||
}
|
||||
this.callListener("close");
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "nsIDOMCallEvent.h"
|
||||
|
||||
#include "DOMError.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "GeneratedEvents.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "Telephony.h"
|
||||
@ -149,7 +149,7 @@ TelephonyCall::NotifyError(const nsAString& aError)
|
||||
// Set the error string
|
||||
NS_ASSERTION(!mError, "Already have an error?");
|
||||
|
||||
mError = DOMError::CreateWithName(aError);
|
||||
mError = new mozilla::dom::DOMError(GetOwner(), aError);
|
||||
|
||||
// Do the state transitions
|
||||
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_DISCONNECTED, true);
|
||||
@ -196,7 +196,7 @@ TelephonyCall::GetEmergency(bool* aEmergency)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelephonyCall::GetError(nsIDOMDOMError** aError)
|
||||
TelephonyCall::GetError(nsISupports** aError)
|
||||
{
|
||||
NS_IF_ADDREF(*aError = mError);
|
||||
return NS_OK;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "TelephonyCommon.h"
|
||||
|
||||
#include "nsIDOMTelephonyCall.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
@ -23,7 +24,7 @@ class TelephonyCall : public nsDOMEventTargetHelper,
|
||||
nsString mNumber;
|
||||
nsString mState;
|
||||
bool mEmergency;
|
||||
nsCOMPtr<nsIDOMDOMError> mError;
|
||||
nsRefPtr<mozilla::dom::DOMError> mError;
|
||||
|
||||
uint32_t mCallIndex;
|
||||
uint16_t mCallState;
|
||||
|
@ -5,11 +5,10 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMEventTarget.idl"
|
||||
#include "nsIDOMDOMError.idl"
|
||||
|
||||
interface nsIDOMEventListener;
|
||||
|
||||
[scriptable, builtinclass, uuid(f0a25998-b0a9-11e2-82d2-60a44c237d2b)]
|
||||
[scriptable, builtinclass, uuid(22e44e8c-cb74-44f2-abe6-b37e9f42ea79)]
|
||||
interface nsIDOMTelephonyCall : nsIDOMEventTarget
|
||||
{
|
||||
readonly attribute DOMString number;
|
||||
@ -21,7 +20,8 @@ interface nsIDOMTelephonyCall : nsIDOMEventTarget
|
||||
// available after dialing state.
|
||||
readonly attribute boolean emergency;
|
||||
|
||||
readonly attribute nsIDOMDOMError error;
|
||||
// This is a DOMError
|
||||
readonly attribute nsISupports error;
|
||||
|
||||
void answer();
|
||||
void hangUp();
|
||||
|
@ -4,12 +4,17 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/2012/WD-dom-20120105/
|
||||
* http://dom.spec.whatwg.org/#domerror
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString name, optional DOMString message = "")]
|
||||
interface DOMError {
|
||||
[Constant]
|
||||
readonly attribute DOMString name;
|
||||
|
||||
[Constant]
|
||||
readonly attribute DOMString message;
|
||||
};
|
||||
|
@ -3,7 +3,6 @@
|
||||
* 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 DOMError;
|
||||
interface Window;
|
||||
|
||||
enum DOMRequestReadyState { "pending", "done" };
|
||||
|
@ -58,6 +58,7 @@ webidl_files = \
|
||||
DocumentFragment.webidl \
|
||||
DocumentType.webidl \
|
||||
DOMCursor.webidl \
|
||||
DOMError.webidl \
|
||||
DOMImplementation.webidl \
|
||||
DOMParser.webidl \
|
||||
DOMRequest.webidl \
|
||||
|
@ -114,8 +114,6 @@ members = [
|
||||
'nsIIDBVersionChangeEvent.*',
|
||||
'nsIIndexedDatabaseManager.*',
|
||||
|
||||
'nsIDOMDOMError.*',
|
||||
|
||||
# dom/file
|
||||
'nsIDOMLockedFile.*',
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TextDecoderBinding.h"
|
||||
#include "mozilla/dom/TextEncoderBinding.h"
|
||||
#include "mozilla/dom/DOMErrorBinding.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsCycleCollector.h"
|
||||
@ -1096,7 +1097,8 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
|
||||
|
||||
// Init WebIDL binding constructors wanted on all XPConnect globals.
|
||||
if (!TextDecoderBinding::GetConstructorObject(aJSContext, global) ||
|
||||
!TextEncoderBinding::GetConstructorObject(aJSContext, global)) {
|
||||
!TextEncoderBinding::GetConstructorObject(aJSContext, global) ||
|
||||
!DOMErrorBinding::GetConstructorObject(aJSContext, global)) {
|
||||
return UnexpectedFailure(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user