Give workers an nsIGlobalObject

RESOLVED FIXED in mozilla26

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: khuey, Assigned: khuey)

Tracking

unspecified
mozilla26
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Comment hidden (empty)
Created attachment 797522 [details] [diff] [review]
Patch

This breaks the inheritance chain since you can't do much useful with a principal on a worker thread anyways.  If you want a principal you really need to get the WorkerPrivate and do specialized stuff.
Attachment #797522 - Flags: review?(bent.mozilla)
Attachment #797522 - Flags: review?(bobbyholley+bmo)
Comment on attachment 797522 [details] [diff] [review]
Patch

Review of attachment 797522 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great. I'm surprised it was so easy.

::: content/events/src/nsDOMDataTransfer.cpp
@@ +492,5 @@
>            nsresult rv = NS_OK;
>            nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
>            NS_ENSURE_TRUE(c && NS_SUCCEEDED(rv), NS_ERROR_DOM_SECURITY_ERR);
> +          nsIGlobalObject* go = c->GetGlobalObject();
> +          NS_ENSURE_TRUE(go, NS_ERROR_DOM_SECURITY_ERR);

I don't think this should be NS_ERROR_DOM_SECURITY_ERR.

::: dom/base/nsIScriptGlobalObject.h
@@ +9,5 @@
>  
>  #include "nsISupports.h"
>  #include "nsEvent.h"
>  #include "nsIGlobalObject.h"
> +#include "nsIScriptObjectPrincipal.h"

As noted on IRC, I don't think we need this.
Attachment #797522 - Flags: review?(bobbyholley+bmo) → review+
Comment on attachment 797522 [details] [diff] [review]
Patch

Review of attachment 797522 [details] [diff] [review]:
-----------------------------------------------------------------

r=me on dom/workers changes
Attachment #797522 - Flags: review?(bent.mozilla) → review+
(In reply to Bobby Holley (:bholley) from comment #2)
> Comment on attachment 797522 [details] [diff] [review]
> Patch
> 
> Review of attachment 797522 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looks great. I'm surprised it was so easy.
> 
> ::: content/events/src/nsDOMDataTransfer.cpp
> @@ +492,5 @@
> >            nsresult rv = NS_OK;
> >            nsIScriptContext* c = pt->GetContextForEventHandlers(&rv);
> >            NS_ENSURE_TRUE(c && NS_SUCCEEDED(rv), NS_ERROR_DOM_SECURITY_ERR);
> > +          nsIGlobalObject* go = c->GetGlobalObject();
> > +          NS_ENSURE_TRUE(go, NS_ERROR_DOM_SECURITY_ERR);
> 
> I don't think this should be NS_ERROR_DOM_SECURITY_ERR.

Everything else in that methods returns NS_ERROR_DOM_SECURITY_ERR, so I left it.

> ::: dom/base/nsIScriptGlobalObject.h
> @@ +9,5 @@
> >  
> >  #include "nsISupports.h"
> >  #include "nsEvent.h"
> >  #include "nsIGlobalObject.h"
> > +#include "nsIScriptObjectPrincipal.h"
> 
> As noted on IRC, I don't think we need this.

Fixed.

Comment 6

5 years ago
https://hg.mozilla.org/mozilla-central/rev/aa8d73a7b08a
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.