Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
amrani
jio
Commits
ea956c97
Commit
ea956c97
authored
Mar 11, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uint8Array added to html5.js for phantomjs compat
parent
e12cd05a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
2 deletions
+59
-2
test/html5.js
test/html5.js
+59
-2
No files found.
test/html5.js
View file @
ea956c97
...
@@ -106,8 +106,59 @@
...
@@ -106,8 +106,59 @@
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
function
Uint8Array
(
one
)
{
// , two, three
/*jslint bitwise: true */
var
i
;
if
(
one
instanceof
Uint8Array
)
{
for
(
i
=
0
;
i
<
one
.
length
;
i
+=
1
)
{
this
[
i
]
=
one
[
i
]
&
0xFF
;
}
this
.
length
=
one
.
length
;
return
;
}
if
(
typeof
one
===
"
number
"
&&
isFinite
(
one
))
{
for
(
i
=
0
;
i
<
one
;
i
+=
1
)
{
this
[
i
]
=
0
;
}
this
.
length
=
one
;
return
;
}
// if (one instanceof ArrayBuffer) {
// two === byteOffset
// three === length
// }
this
.
length
=
0
;
}
Uint8Array
.
prototype
.
set
=
function
()
{
throw
new
Error
(
"
Not implemented
"
);
};
Uint8Array
.
prototype
.
subarray
=
function
(
begin
,
end
)
{
if
(
typeof
begin
!==
"
number
"
||
!
isFinite
(
begin
)
||
begin
<
0
)
{
begin
=
0
;
}
if
(
begin
>
this
.
length
)
{
begin
=
this
.
length
;
}
if
(
typeof
end
!==
"
number
"
||
!
isFinite
(
end
)
||
end
>
this
.
length
)
{
end
=
this
.
length
;
}
if
(
end
<
begin
)
{
end
=
begin
;
}
var
i
,
j
,
uint8array
=
new
Uint8Array
(
end
-
begin
);
/*jslint bitwise: true */
for
(
i
=
begin
,
j
=
0
;
i
<
end
;
i
+=
1
,
j
+=
1
)
{
uint8array
[
j
]
=
this
[
i
]
&
0xFF
;
}
return
uint8array
;
};
////////////////////////////////////////////////////////////
function
Blob
(
parts
,
properties
)
{
function
Blob
(
parts
,
properties
)
{
var
i
,
part
,
raw
=
''
,
type
;
var
i
,
j
,
part
,
raw
=
''
,
type
;
type
=
(
properties
&&
properties
.
type
&&
properties
.
type
.
toString
())
||
""
;
type
=
(
properties
&&
properties
.
type
&&
properties
.
type
.
toString
())
||
""
;
if
(
!
Array
.
isArray
(
parts
))
{
if
(
!
Array
.
isArray
(
parts
))
{
throw
new
TypeError
(
"
The method parameter is missing or invalid.
"
);
throw
new
TypeError
(
"
The method parameter is missing or invalid.
"
);
...
@@ -121,6 +172,11 @@
...
@@ -121,6 +172,11 @@
part
=
parts
[
i
];
part
=
parts
[
i
];
if
(
part
instanceof
Blob
)
{
if
(
part
instanceof
Blob
)
{
raw
+=
part
.
_data
;
raw
+=
part
.
_data
;
}
else
if
(
part
instanceof
Uint8Array
)
{
/*jslint bitwise: true */
for
(
j
=
0
;
j
<
part
.
length
;
j
+=
1
)
{
raw
+=
String
.
fromCharCode
(
part
[
j
]
&
0xFF
);
}
}
else
if
(
part
)
{
}
else
if
(
part
)
{
raw
+=
stringToUtf8ByteString
(
part
.
toString
());
raw
+=
stringToUtf8ByteString
(
part
.
toString
());
}
else
if
(
part
===
undefined
)
{
}
else
if
(
part
===
undefined
)
{
...
@@ -262,7 +318,8 @@
...
@@ -262,7 +318,8 @@
(
/
\b
PhantomJS
\b
/i
).
test
(
navigator
.
userAgent
))
{
(
/
\b
PhantomJS
\b
/i
).
test
(
navigator
.
userAgent
))
{
window
.
Blob
=
Blob
;
window
.
Blob
=
Blob
;
window
.
FileReader
=
FileReader
;
window
.
FileReader
=
FileReader
;
//console.warn("Blob and FileReader have been replaced!");
window
.
Uint8Array
=
Uint8Array
;
//console.warn("Blob, FileReader and Uint8Array have been replaced!");
}
}
if
(
!
Function
.
prototype
.
bind
)
{
if
(
!
Function
.
prototype
.
bind
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment