Skip to content
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

Improving CanvasPixelArray polyfill for Android #5004

Merged
merged 1 commit into from
Jun 30, 2014

Conversation

CodingFabian
Copy link
Contributor

The old polyfill was only polyfilling IE which uses the CanvasPixelArray from window.
PR #4997 fixed the issue reported in #4974 that Chrome < 21 does not work.
The CPA used by those Chrome Versions is unfortunately inaccessible and needs to be patched every time it is created.
The same applies to old versions of the mobile browser in Android, as mentioned by #5002.
Android < 4.4 does not use Chrome, but a custom webkit based engine which does the same as Chrome < 21.
This PR detects Android 0-4 versions and polyfills them as well. Newer Android versions which use Chrome will still be handled by the check of PR #4997.

I also checked iOS and Mobile FF. iOS 6+7 are fine (they have the set method), iOS 5 does ot work at all, thus I did not bother polyfilling.

// Chrome < 21 lacks the set function.
polyfill = true;
}
} else if (navigator.userAgent.indexOf('Android') >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, Firefox for android has it too, but does not need polifill

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i checked that. FF for Android has it but will not pass the regex below.
I could turn it into 'Android ' and document the importance of the space in a comment if you think thats more explicit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, just checking

@yurydelendik
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/60d1dbe4090c96b/output.txt

@CodingFabian
Copy link
Contributor Author

this could be merged. I checked that the polyfill is working correctly on older android phones. The performance is sub par, but that is not the problem of the polyfill.

timvandermeij added a commit that referenced this pull request Jun 30, 2014
Improving CanvasPixelArray polyfill for Android
@timvandermeij timvandermeij merged commit 0ac8380 into mozilla:master Jun 30, 2014
@timvandermeij
Copy link
Contributor

Looks good. Thank you for the patch!

@CodingFabian CodingFabian deleted the issue-5002 branch July 1, 2014 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants