liunian / crypto-js

Automatically exported from code.google.com/p/crypto-js
0 stars 0 forks source link

typed array support for IE10 #81

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to compute an MD5 checksum of a file in IE10

What is the expected output? What do you see instead?

IE10 does not have Uint8ClampedArray, and so the check "if (typedArray 
instanceof Uint8ClampedArray)" in lib-typedarrays.js fails with an error that 
Uint8ClampedArray isn't defined.

What version of the product are you using? On what operating system?
Windows 7 IE 10

Please provide any additional information below.

A simple fix would be to change the check to
if (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof 
Uint8ClampedArray)

Thanks,
Evan

Original issue reported on code.google.com by evanwor...@gmail.com on 27 Feb 2013 at 2:13

GoogleCodeExporter commented 9 years ago
The same issue was reported in Safari. It's fixed in dev, and that fix should 
be out soon with the next release.

Original comment by Jeff.Mott.OR on 27 Feb 2013 at 3:04

GoogleCodeExporter commented 9 years ago
Hi Jeff,

I'm actually seeing other errors trying to compute MD5s in IE10. It seems that 
CryptoJS.lib.WordArray.create(Uint8Array) is giving me very different results 
for IE10 and Chrome. I did some inspection and I believe the Uint8Array's 
contain the same input data in both browsers.

Have you seen anything like this? In particular in Chrome, the Word array that 
is returned has N/4 entries (where N is the number if bytes in the Uint8Array), 
as expected. However, in IE10 there is something like 3N words returned. It 
makes no sense to me, but maybe you have an idea?

Please let me know. I can keep going down the rabbit hole if you are not sure. 
I will need to get this fixed one way or another, so I'm happy to contribute.

Thanks,
Evan

Original comment by evanwor...@gmail.com on 27 Feb 2013 at 11:04

GoogleCodeExporter commented 9 years ago
Minor update: I've got a test bed running which works for IE10 and Chrome, so 
now I'm trying to figure out why it doesn't work in my application. Looking 
good for the library's compatibility with IE10, though I'm still confused about 
what is different in the real world. More to come.

Original comment by evanwor...@gmail.com on 28 Feb 2013 at 10:37

GoogleCodeExporter commented 9 years ago
So I've got uploads working from IE, by removing lib-typedarray and just doing 
my own conversion from a byte array to a word array. I think something was 
going wrong with loading lib-typedarray and the uint8array wasn't actually 
being converted. Might still be worth a quick look if/when you have a minute.

Original comment by evanwor...@gmail.com on 1 Mar 2013 at 1:32

GoogleCodeExporter commented 9 years ago
My guess is the rest of lib-typedarray is working because of the 
Uint8ClampedArray issue.

Original comment by Jeff.Mott.OR on 1 Mar 2013 at 2:15

GoogleCodeExporter commented 9 years ago
I replaced lib-typedarray.js with the current source, and I am getting the 
right funtional results, however I am seeing this message in a "Webpage Error" 
popup

    Line: 1
    Error: 'Uint8ClampedArray' is undefined

And I see this in the F12 Developer Tools:

    SCRIPT5009: 'Uint8ClampedArray' is undefined 
    lib-typedarrays.js, line 1 character 2

Original comment by kevin.ha...@gmail.com on 8 Apr 2013 at 3:30

GoogleCodeExporter commented 9 years ago
This issue is still there with CryptoJS 3.1.2-2 on IE 11.0.3

Original comment by tobias.o...@gmail.com on 2 Mar 2014 at 12:35

GoogleCodeExporter commented 9 years ago
Looking back to how I "fixed" this, I "lied" to IE and made Uint8ClampedArray = 
Uint8Array

    <script>
        if (typeof Uint8ClampedArray == "undefined") {
            Uint8ClampedArray = Uint8Array;
        }
    </script>
    <script src="cryptojs/components/lib-typedarrays.js"></script>

Original comment by kevin.ha...@gmail.com on 2 Mar 2014 at 1:19

GoogleCodeExporter commented 9 years ago
Any plans to fix this soon? I'm still facing that issue with CryptoJS 3.1.2-2.

Original comment by christop...@gmail.com on 22 Apr 2014 at 1:15