Bug 1288768 - Better error reporting for network errors in workers

This commit is contained in:
janekptacijarabaci 2018-04-04 21:36:19 +02:00 • committed by Roy Tam
commit 12f3d0302c
5 changed files with 132 additions and 26 deletions

View file

@ -412,8 +412,17 @@ Event::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<Event> e = new Event(t, nullptr, nullptr);
bool trusted = e->Init(t);
return Constructor(t, aType, aParam);
}
// static
already_AddRefed<Event>
Event::Constructor(EventTarget* aEventTarget,
const nsAString& aType,
const EventInit& aParam)
{
RefPtr<Event> e = new Event(aEventTarget, nullptr, nullptr);
bool trusted = e->Init(aEventTarget);
e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
e->SetTrusted(trusted);
e->SetComposed(aParam.mComposed);
@ -1209,7 +1218,7 @@ Event::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
}
NS_IMETHODIMP_(void)
Event::SetOwner(mozilla::dom::EventTarget* aOwner)
Event::SetOwner(EventTarget* aOwner)
{
mOwner = nullptr;

View file

@ -142,6 +142,10 @@ public:
LayoutDeviceIntPoint aPoint,
CSSIntPoint aDefaultPoint);
static already_AddRefed<Event> Constructor(EventTarget* aEventTarget,
const nsAString& aType,
const EventInit& aParam);
static already_AddRefed<Event> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const EventInit& aParam,