Skip to content

Fix for web worker test in Safari#1849

Merged
yurydelendik merged 9 commits intomozilla:masterfrom
kingsquare:master
Jun 28, 2012
Merged

Fix for web worker test in Safari#1849
yurydelendik merged 9 commits intomozilla:masterfrom
kingsquare:master

Conversation

@Reggino
Copy link
Copy Markdown
Contributor

@Reggino Reggino commented Jun 26, 2012

Safari can not read or write typed arrays to 'web workers'. This will cause Safari on the iPhone and iPad to crash. The desktop version of Safari just throws a weird error.

This behaviour is tested by pdf.js while a pdf is being downloaded from a URL. However, sometimes the pdf has finished downloading BEFORE the web worker-test has finished! In that case the rendering of the final pdf would cause errors, because the web workers have not yet been disabled.

This patch fixes this and the issues #1314, #1627, #1643, #1846 and #1805 .

Comment thread src/api.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indentation is wrong

@yurydelendik
Copy link
Copy Markdown
Contributor

/botio-linux lint

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/14c05dc01cdbab4/output.txt

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/14c05dc01cdbab4/output.txt

Total script time: 1.17 mins

  • Lint: FAILED

@yurydelendik
Copy link
Copy Markdown
Contributor

Thank you for investigating this. Please address the long lines, illegal tabs and other lint issues.

Also, this patch might conflict with #1840.

/botio-windows preview

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/2dd123771760a8a/output.txt

@pdfjsbot
Copy link
Copy Markdown

@Reggino
Copy link
Copy Markdown
Contributor Author

Reggino commented Jun 27, 2012

Hmmm i just found out that iPhone / iPad support needs some more love... will look further into that...

@Reggino
Copy link
Copy Markdown
Contributor Author

Reggino commented Jun 27, 2012

pdf.js now is actually working on iOS again. I found out that Uint8array on Safari 5 is lacking the subarray-method and has another issue with Object.defineProperty and DOM objects. This is now fixed and the code is made lint-compliant.

Comment thread web/compatibility.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like it shall be !/Safari\/5/.test(navigator.userAgent)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wow, great catch!

The reason this slipped through is because my iPad seems to be running Safari 6 and that browser is still having the same issue. Fixed it, thanks @yurydelendik

@yurydelendik
Copy link
Copy Markdown
Contributor

/botio-windows lint

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/257ea6e3d31d34b/output.txt

@yurydelendik
Copy link
Copy Markdown
Contributor

/botio-linux preview

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/fc664b957bebc0c/output.txt

@pdfjsbot
Copy link
Copy Markdown

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/257ea6e3d31d34b/output.txt

Total script time: 1.19 mins

  • Lint: Passed

Comment thread web/compatibility.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should not be looking at the user agent. Use feature detection instead. See https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js#L599 for inspiration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. I've updated the test accordingly... Thanks!

@brendandahl
Copy link
Copy Markdown
Contributor

/botio-windows lint
/botio-linux preview

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/87d064919c336a3/output.txt

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Received

Command cmd_lint from @brendandahl received. Current queue size: 0

Live output at: http://107.22.172.223:8877/820df6c19fffd51/output.txt

@pdfjsbot
Copy link
Copy Markdown

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/820df6c19fffd51/output.txt

Total script time: 1.31 mins

  • Lint: Passed

@Reggino
Copy link
Copy Markdown
Contributor Author

Reggino commented Jun 28, 2012

/botio-windows lint
/botio-linux preview

1 similar comment
@jviereck
Copy link
Copy Markdown
Contributor

/botio-windows lint
/botio-linux preview

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Received

Command cmd_lint from @jviereck received. Current queue size: 0

Live output at: http://107.22.172.223:8877/04043f768493b8a/output.txt

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/9ce7abdaeeccada/output.txt

@pdfjsbot
Copy link
Copy Markdown

@pdfjsbot
Copy link
Copy Markdown

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/04043f768493b8a/output.txt

Total script time: 1.23 mins

  • Lint: Passed

yurydelendik added a commit that referenced this pull request Jun 28, 2012
Fix for web worker test in Safari
@yurydelendik yurydelendik merged commit 665ff0d into mozilla:master Jun 28, 2012
@yurydelendik
Copy link
Copy Markdown
Contributor

Thank you for the patch

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.

5 participants