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

[ManagedMSE] JS ManagedSourceBuffer object doesn't present any of its attributes #14092

Merged
merged 1 commit into from May 20, 2023

Conversation

jyavenard
Copy link
Member

@jyavenard jyavenard commented May 19, 2023

202d7e7

[ManagedMSE] JS ManagedSourceBuffer object doesn't present any of its attributes
https://bugs.webkit.org/show_bug.cgi?id=257037
rdar://109569570

Reviewed by Chris Dumez.

Add missing custom toJS for MediaSource and SourceBuffer.

* LayoutTests/media/media-source/media-managedmse-bufferedchange-expected.txt:
* LayoutTests/media/media-source/media-managedmse-bufferedchange.html:
* Source/WebCore/Modules/mediasource/MediaSource.idl:
* Source/WebCore/Modules/mediasource/SourceBuffer.idl:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSMediaSourceCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* Source/WebCore/bindings/js/JSSourceBufferCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):

Canonical link: https://commits.webkit.org/264284@main

f2252ea

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@jyavenard jyavenard requested a review from cdumez as a code owner May 19, 2023 18:52
@jyavenard jyavenard self-assigned this May 19, 2023
@jyavenard jyavenard added the Media Bugs related to the HTML 5 Media elements. label May 19, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 19, 2023
@jyavenard jyavenard removed the merging-blocked Applied to prevent a change from being merged label May 19, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 19, 2023
@jyavenard jyavenard removed the merging-blocked Applied to prevent a change from being merged label May 19, 2023
@@ -37,6 +37,10 @@
run('sourceBuffer.appendBuffer(loader.initSegment())');
await waitFor(sourceBuffer, 'update');

sourceBuffer.onbufferedchange = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing isn't great. I'd add something like:

shouldBe("sourceBuffer.__proto__", "ManagedSourceBuffer.prototype");
shouldBeTrue("sourceBuffer.hasOwnProperty('onbufferedchange')");

Or whatever the equivalent is in media tests.

A test that doesn't FAIL when the property is missing is not a good test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would have failed if the property was missing.
That's how I found the bug to start.

If the sourceBuffer object is actually a SourceBuffer rather than a ManagedSourceBuffer then the onbufferedchange property doesn't exist to start, and so setting it does nothing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't have failed, it would have given different output which could have easily been mistakenly rebaselined. It is bad practice. Please make it so that the test output contains a FAIL line if the property is missing.


#include "config.h"

#if ENABLE(MANAGED_MEDIA_SOURCE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right...

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 19, 2023
@jyavenard jyavenard removed the merging-blocked Applied to prevent a change from being merged label May 19, 2023
Copy link
Contributor

@cdumez cdumez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % nits.

#if ENABLE(MANAGED_MEDIA_SOURCE)
#include "JSManagedSourceBuffer.h"
#endif
#include "JSSourceBuffer.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First come the non guarded includes, then the guarded ones with a blank line in between, so it should look like:

#include "JSSourceBuffer.h"

#if ENABLE(MANAGED_MEDIA_SOURCE)
#include "JSManagedSourceBuffer.h"
#endif

@@ -35,6 +35,9 @@
waitFor(video, 'error').then(failTest);

run('sourceBuffer = source.addSourceBuffer(loader.type())');
testExpected('sourceBuffer.__proto__', ManagedSourceBuffer.prototype);
testExpected('sourceBuffer.onbufferedchange !== undefined', true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment was to add these checks in addition to your new event listener. Checking that the event listener gets called seemed useful too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed ; but right now there's another bug that makes it behave differently if the GPU process is turned on. I will fix it soon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. Fine.

@jyavenard jyavenard added the merge-queue Applied to send a pull request to merge-queue label May 20, 2023
… attributes

https://bugs.webkit.org/show_bug.cgi?id=257037
rdar://109569570

Reviewed by Chris Dumez.

Add missing custom toJS for MediaSource and SourceBuffer.

* LayoutTests/media/media-source/media-managedmse-bufferedchange-expected.txt:
* LayoutTests/media/media-source/media-managedmse-bufferedchange.html:
* Source/WebCore/Modules/mediasource/MediaSource.idl:
* Source/WebCore/Modules/mediasource/SourceBuffer.idl:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSMediaSourceCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* Source/WebCore/bindings/js/JSSourceBufferCustom.cpp: Added.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):

Canonical link: https://commits.webkit.org/264284@main
@webkit-commit-queue
Copy link
Collaborator

Committed 264284@main (202d7e7): https://commits.webkit.org/264284@main

Reviewed commits have been landed. Closing PR #14092 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 202d7e7 into WebKit:main May 20, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Bugs related to the HTML 5 Media elements.
Projects
None yet
5 participants