-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Clear out pending errors on player disposal. #1481
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -601,3 +601,20 @@ test('should honor disabled inactivity timeout', function() { | |
|
||
clock.restore(); | ||
}); | ||
|
||
test('should clear pending errors on disposal', function() { | ||
var clock = sinon.useFakeTimers(), player; | ||
|
||
player = PlayerTest.makePlayer(); | ||
player.src({ | ||
src: 'http://example.com/movie.unsupported-format', | ||
type: 'video/unsupported-format' | ||
}); | ||
player.dispose(); | ||
try { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is a try needed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, is it to catch an error, if it's thrown? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep |
||
clock.tick(5000); | ||
} catch (e) { | ||
return ok(!e, 'threw an error: ' + e.message); | ||
} | ||
ok(true, 'did not throw an error after disposal'); | ||
}); |
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.
Everywhere else in the player spec any options are set in the options object for
makePlayer
. Any reason you didn't go that route here?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.
I encountered this issue originally through calling
src()
after the player was constructed so I reproduced that scenario for my test case. I'm fairly certain the same error would occur if the sources came in through options. Do you want me to adjust the test?