Open Bug 890364 Opened 11 years ago Updated 2 years ago

Allow defining WebIDL constructor objects on non-global objects

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

People

(Reporter: Ms2ger, Unassigned)

References

(Blocks 1 open bug)

Details

IndexedDatabaseManager::InitWindowless needs this.
Both GetProtoObject and GetConstructorObject need to be changed here.
So, I tried to take a stab at it. The problem is that CreateInterfaceObjects also uses the iface/proto cache and I have a very hard time understanding the codegen parts enough to be able to change it with any level of confidence... I guess we need bz/peterv's help here.
Flags: needinfo?(peterv)
Flags: needinfo?(bzbarsky)
Why do we want to define these on non-global objects? AFAICT IndexedDatabaseManager::InitWindowless is usually called on global objects right now. Eventually we should just expose all DOM interface objects on the global object of components anyway.
Flags: needinfo?(peterv)
(In reply to comment #3) > Why do we want to define these on non-global objects? AFAICT > IndexedDatabaseManager::InitWindowless is usually called on global objects > right now. Eventually we should just expose all DOM interface objects on the > global object of components anyway. I think the summary for this bug is misleading. We're talking about non-window/worker globals, presumbaly things like the globals in jsm's, etc.
Worker globals already work. JSM globals should just work given that they're using XPCONNECT_GLOBAL_FLAGS. What's the exact problem that we're trying to solve?
Well, in that case, initWindowless() should not be needed at all, right?
Flags: needinfo?(bent.mozilla)
In particular, if you add this interface to the list at the end of nsXPConnect::InitClassesWithNewWrappedGlobal that will expose the constructor on all xpconnect globals; then the constructor can check whether the global it's given is a Window.
Flags: needinfo?(bzbarsky)
Blocks: 890382
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #4) > I think the summary for this bug is misleading. We're talking about > non-window/worker globals, presumbaly things like the globals in jsm's, etc. What is the difference between this bug and bug 859901?
(In reply to :Ehsan Akhgari (needinfo? me!) from comment #4) > (In reply to comment #3) > > Why do we want to define these on non-global objects? AFAICT > > IndexedDatabaseManager::InitWindowless is usually called on global objects > > right now. Eventually we should just expose all DOM interface objects on the > > global object of components anyway. > > I think the summary for this bug is misleading. We're talking about > non-window/worker globals, presumbaly things like the globals in jsm's, etc. That's not what I'm talking about. The API we have now allows passing any object to IndexedDatabaseManager::InitWindowless. If we want to break that, fine; otherwise we need to allow that.
I don't know if we want to keep this behavior or not. It's modeled after Components.utils.import, allowing you to define the IDB stuff on a temporary object that then gets throw away or something. I imagine most consumers still pass the global anyway so it might not matter. Let's not worry about this for now, we can always swing back around and do this later.
Flags: needinfo?(bent.mozilla)
(In reply to comment #10) > I don't know if we want to keep this behavior or not. It's modeled after > Components.utils.import, allowing you to define the IDB stuff on a temporary > object that then gets throw away or something. I imagine most consumers still > pass the global anyway so it might not matter. Let's not worry about this for > now, we can always swing back around and do this later. If we expose the necessary IDB interfaces on the global object, breaking that behavior sounds like a feature to me!
Turns out that B2G feels like it needs this: https://tbpl.mozilla.org/php/getParsedLog.php?id=26040134&tree=Try
(In reply to comment #12) > Turns out that B2G feels like it needs this: > https://tbpl.mozilla.org/php/getParsedLog.php?id=26040134&tree=Try Well, that's just this code: http://mxr.mozilla.org/mozilla-central/source/dom/activities/src/ActivitiesService.jsm#42 Can't we just remove that?
Indeed, that's passing a global object to initWindowless. So as long as that global has the relevant bits already, there should be no problem.
Depends on: 920553
What's the status and next steps here now?
Renaming the bug summary to something like "Kill IndexedDatabaseManager::InitWindowless()"?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.