Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageEvent and ExtendableMessageEvent have some issues #25464

Closed
Manishearth opened this issue Jan 8, 2020 · 0 comments
Closed

MessageEvent and ExtendableMessageEvent have some issues #25464

Manishearth opened this issue Jan 8, 2020 · 0 comments

Comments

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Jan 8, 2020

The implementations of MessageEvent and ExtendableMessageEvent have some issues.

Firstly, they store Vec<DomRoot<T>> in on their DOM object, they should be using Vec<Dom<T>>:

ports: DomRefCell<Vec<DomRoot<MessagePort>>>,

ports: Vec<DomRoot<MessagePort>>,

Secondly, they're constructing the type directly in new() instead of using a new_inherited

let ev = Box::new(ExtendableMessageEvent {
event: ExtendableEvent::new_inherited(),
data: Heap::default(),
origin,
lastEventId,
ports,
});

let ev = Box::new(MessageEvent {
event: Event::new_inherited(),
data: Heap::default(),
source: DomRefCell::new(source.map(|source| source.into())),
origin: DomRefCell::new(origin),
lastEventId: DomRefCell::new(lastEventId),
ports: DomRefCell::new(ports),
});

We should fix these issues.

cc @gterzian

bors-servo added a commit that referenced this issue Jan 9, 2020
Use dom and new_inherited in (extendable)messageevent

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #25464 (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo bors-servo closed this in f8c957d Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.