Closed Bug 1513878 Opened 5 years ago Closed 5 years ago

Implement a getter method to WindowGlobalParent/WindowGlobalChild

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Fission Milestone M1
Tracking Status
firefox67 --- fixed

People

(Reporter: jdai, Assigned: jdai)

References

Details

Attachments

(6 files, 3 obsolete files)

Priority: -- → P2
This bug will provide a getter method from WindowGlobalParent/WindowGlobalChild.

[ChromeOnly]
partial interface WindowGlobalParent {
// Getter method added to WindowGlobalParent. When called looks up the 
// corresponding actor, constructs it if it hasn't been constructed yet, 
// and returns it.
[Throws]
WindowActorParent getActor(DOMString name);
};

[ChromeOnly]
partial interface WindowGlobalChild {
// Getter method added to WindowGlobalParent. When called looks up the 
// corresponding actor, constructs it if it hasn't been constructed yet, 
// and returns it.
[Throws]
WindowActorChild getActor(DOMString name);
};

Summarize the current status, the bug needs to do the following things:

  1. Looks up the corresponding actor.
  2. Constructed it if it hasn't been constructed yet.
    2a. Load module URI.
    2b. Construct the actor.
  3. Return the actor.

I'm working on 2b. In 2b, I was trying two different ways to construct an actor. The first way, I want to get constructor from module's export, then call the constructor to create an object instance. However, I can't get constructor from module's export. I guess it's because the module's export only has the class declaration, not the instance of the class, so there is no constructor's function object. The second way, I want to get class from module's export, then create an object instance by the class. However, I use JS_NewObject to create an object instance, the prototype is undefined. If I'm in the wrong direction, please let me know.

Nika pointed out that I missed adding [Constructor] in webidl. That is the main reason that calls the constructor to create an object instance doesn't work[1].

[1] https://heycam.github.io/webidl/#Constructor

Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f4f787d9a250126e893e8c28d04333bb91de4142

GetWindowGlobalChild[1] should be exposed to webidl so that the test case can get an actor from the child side. Retrieve the review request, I will update the patches and send a review again.

[1] https://searchfox.org/mozilla-central/source/dom/base/nsPIDOMWindow.h#367

Attachment #9035946 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Pushed by jdai@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/48b36980fe1c
Part 1: Expose window global child to window. r=nika
https://hg.mozilla.org/integration/autoland/rev/0333640041bb
Part 2: Implement a getter method to WindowGlobalParent/WindowGlobalChild. r=nika
https://hg.mozilla.org/integration/autoland/rev/a480d92de046
Part 3: Add getActor test for WindowGlobalParent/WindowGlobalChild. r=nika

It's only happened at Android 4.2 x86 debug, and errors show at
/builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/PaymentMethodChangeEvent.h:32:43: error: unknown type name 'ChangeDetails'
/builds/worker/workspace/build/src/obj-firefox/dom/bindings/PaymentMethodChangeEventBinding.cpp:279:15: error: cannot initialize object parameter of type 'const mozilla::dom::Event' with an expression of type 'mozilla::dom::PaymentMethodChangeEvent'
/builds/worker/workspace/build/src/obj-firefox/dom/bindings/PaymentMethodChangeEventBinding.cpp:587:14: error: static_cast from 'mozilla::dom::PaymentMethodChangeEvent *' to 'mozilla::dom::PaymentRequestUpdateEvent *', which are not related by inheritance, is not allowed
/builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/BindingUtils.h:2424:14: error: no matching member function for call to 'PreserveWrapper'
/builds/worker/workspace/build/src/obj-firefox/dist/include/nsISupportsUtils.h:121:3: error: static_assert failed "don't use CallQueryInterface for compile-time-determinable casts"
/builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/BindingUtils.h:982:19: error: cannot initialize object parameter of type 'const nsWrapperCache' with an expression of type 'mozilla::dom::PaymentMethodChangeEvent'
/builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/BindingUtils.h:1608:37: error: cannot initialize object parameter of type 'mozilla::dom::Event' with an expression of type 'mozilla::dom::PaymentMethodChangeEvent'
/builds/worker/workspace/build/src/obj-firefox/dist/include/nsCycleCollectionNoteChild.h:46:52: error: cannot initialize a parameter of type 'mozilla::dom::Event *' with an lvalue of type 'mozilla::dom::PaymentMethodChangeEvent *'

Flags: needinfo?(jdai)
Attachment #9039544 - Attachment is obsolete: true
Attachment #9039553 - Attachment is obsolete: true
Pushed by jdai@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/845c2f0d18b5
Part 1: Expose window global child to window. r=nika
https://hg.mozilla.org/integration/autoland/rev/d7289306549f
Part 2: Implement a getter method to WindowGlobalParent/WindowGlobalChild. r=nika
https://hg.mozilla.org/integration/autoland/rev/640f4072f19a
Part 3: Add getActor test for WindowGlobalParent/WindowGlobalChild. r=nika

(In reply to John Dai[:jdai] from comment #12)

The problem is that PaymentMethodChangeEvent.h[1] doesn't include header file for ChangeDetails.

[1] https://searchfox.org/mozilla-central/rev/4faab2f1b697827b93e16cb798b22b197e5235c9/dom/payments/PaymentMethodChangeEvent.h#51

See Also: → 1523399
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Fission Milestone: --- → M1
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: