Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8c74b8e2
authored
2015-04-10 16:28:12 -0400
by
Lee Whitaker
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Clean up aborts better.
1 parent
7add9298
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
src/playlist-loader.js
test/playlist-loader_test.js
src/playlist-loader.js
View file @
8c74b8e
...
...
@@ -118,7 +118,9 @@
*/
loader
.
dispose
=
function
()
{
if
(
request
)
{
request
.
onreadystatechange
=
null
;
request
.
abort
();
request
=
null
;
}
window
.
clearTimeout
(
mediaUpdateTimeout
);
dispose
.
call
(
this
);
...
...
@@ -161,6 +163,7 @@
if
(
loader
.
master
.
playlists
[
playlist
.
uri
].
endList
)
{
// abort outstanding playlist requests
if
(
request
)
{
request
.
onreadystatechange
=
null
;
request
.
abort
();
request
=
null
;
}
...
...
@@ -188,6 +191,7 @@
// has no effect after the first
return
;
}
request
.
onreadystatechange
=
null
;
request
.
abort
();
request
=
null
;
}
...
...
test/playlist-loader_test.js
View file @
8c74b8e
...
...
@@ -331,6 +331,7 @@
clock
.
tick
(
10
*
1000
);
loader
.
media
(
'high.m3u8'
);
strictEqual
(
requests
[
0
].
aborted
,
true
,
'aborted refresh request'
);
ok
(
!
requests
[
0
].
onreadystatechange
,
'onreadystatechange handlers should be removed on abort'
);
strictEqual
(
loader
.
state
,
'SWITCHING_MEDIA'
,
'updated the state'
);
});
...
...
@@ -417,6 +418,7 @@
strictEqual
(
requests
.
length
,
1
,
'requested high playlist'
);
ok
(
requests
[
0
].
aborted
,
'aborted playlist request'
);
ok
(
!
requests
[
0
].
onreadystatechange
,
'onreadystatechange handlers should be removed on abort'
);
strictEqual
(
loader
.
state
,
'HAVE_METADATA'
,
'returned to loaded playlist'
);
strictEqual
(
loader
.
media
(),
loader
.
master
.
playlists
[
0
],
'switched to loaded playlist'
);
});
...
...
@@ -498,6 +500,7 @@
loader
.
dispose
();
ok
(
requests
[
0
].
aborted
,
'refresh request aborted'
);
ok
(
!
requests
[
0
].
onreadystatechange
,
'onreadystatechange handler should not exist after dispose called'
);
});
test
(
'errors if requests take longer than 45s'
,
function
()
{
...
...
Please
register
or
sign in
to post a comment