-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix our WebIDL for Safari #909
Conversation
[Throws] | ||
void start(optional double when = 0, optional double grainOffset = 0, | ||
optional double grainDuration); | ||
|
||
[Throws] | ||
void stop (optional double when = 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this class didn't switch to AudioBufferSourceNode includes rustAudioScheduledSourceNode;
because the mixin's start
method conflicts with the start
method in this class, so it was just easier to inline the few properties here.
d074e10
to
5fb1bde
Compare
@@ -32,7 +32,12 @@ interface AudioBufferSourceNode : AudioScheduledSourceNode { | |||
attribute double loopStart; | |||
attribute double loopEnd; | |||
|
|||
attribute EventHandler onended; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the indentation of this line is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh it is indeed wrong!
(a copy/paste error)
crates/webidl/src/lib.rs
Outdated
probably stop using this class and instead \ | ||
use the class that inherits from this, which \ | ||
should include all the same methods and work \ | ||
in all browsers in theory!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if we could tailor the deprecation message for the particular interfaces. Something like:
// BaseAudioContext.webidl
[Deprecated="reason why this is deprecated detailed here..."]
interface BaseAudioContext {
// ...
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure yeah, I can upate this
@@ -16,8 +16,6 @@ features = [ | |||
'AudioDestinationNode', | |||
'AudioNode', | |||
'AudioParam', | |||
'AudioScheduledSourceNode', | |||
'BaseAudioContext', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't removing features a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh these aren't removed from web-sys
itself, just here because the features are no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'oh I totally misread what file this was
let fm_osc; | ||
let gain; | ||
let fm_gain; | ||
pub fn new() -> Result<FmOsc, JsValue> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
This commit employs the strategy described in rustwasm#908 to apply a non-breaking change to fix WebIDL to be compatible with all browsers, including Safari. The problem here is that `BaseAudioContext` and `AudioScheduledSourceNode` are not types in Safari, but they are types in Firefox/Chrome. The fix here was to move the contents of these two interfaces into mixins, and then include the mixins in all classes which inherit from these two classes. That should have the same effect as defining the methods inherently on the original interface. Additionally a special `[RustDeprecated]` attribute to WebIDL was added to signify interfaces this has happened to. Currently it's directly tailored towards this case of "this intermediate class doesn't exist in all browsers", but we may want to refine and extend the deprecation message over time. Although it's possible we could do this as a breaking change to `web-sys` I'm hoping that we can do this as a non-breaking change for now and then eventually on the next breaking release batch all these changes together, deleting the intermediate classes. This is also hopefully a good trial run for how stable web-sys can be when it's actually stable! cc rustwasm#897 cc rustwasm#908
5fb1bde
to
bb7271a
Compare
Updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This commit employs the strategy described in #908 to apply a
non-breaking change to fix WebIDL to be compatible with all browsers,
including Safari.
The problem here is that
BaseAudioContext
andAudioScheduledSourceNode
are not types in Safari, but they are types in Firefox/Chrome. The fix
here was to move the contents of these two interfaces into mixins, and
then include the mixins in all classes which inherit from these two
classes. That should have the same effect as defining the methods
inherently on the original interface.
Additionally a special
[RustDeprecated]
attribute to WebIDL was addedto signify interfaces this has happened to. Currently it's directly
tailored towards this case of "this intermediate class doesn't exist in
all browsers", but we may want to refine and extend the deprecation
message over time.
Although it's possible we could do this as a breaking change to
web-sys
I'm hoping that we can do this as a non-breaking change fornow and then eventually on the next breaking release batch all these
changes together, deleting the intermediate classes. This is also
hopefully a good trial run for how stable web-sys can be when it's
actually stable!
cc #897
cc #908