Navigation Menu

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

Do not use eval in minified piwik.js, replace JSON2 with JSON3 #8896

Merged
merged 2 commits into from Oct 4, 2015
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 2, 2015

fixes #5960 refs #1542

@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 2, 2015
@tsteur tsteur added this to the 2.15.0 milestone Oct 2, 2015
@@ -5624,7 +6188,9 @@ if (typeof piwik_log !== 'function') {

function getOption(optionName) {
try {
return eval('piwik_' + optionName);
if (window['piwik_' + optionName]) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how the old tracker used to work but this should be the same

@tsteur
Copy link
Member Author

tsteur commented Oct 2, 2015

After merging it, I'd run the tests on some older browsers via saucelabs on top to make sure it works with IE6 etc

@@ -439,10 +439,14 @@ function PiwikTest() {
var src = '<?php
$src = file_get_contents('../../js/piwik.js');
$src = strtr($src, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
$src = substr($src, strpos($src, '/* startjslint */'));
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a workaround to not run JSON3 through JSLINT as we cannot make it JSLINT compatible

mattab pushed a commit that referenced this pull request Oct 4, 2015
Do not use eval in minified piwik.js, replace JSON2 with JSON3
@mattab mattab merged commit 757566b into master Oct 4, 2015
@mattab mattab deleted the 1542 branch October 4, 2015 21:09
@mattab
Copy link
Member

mattab commented Oct 4, 2015

Nice. Next step: #1542

@tsteur
Copy link
Member Author

tsteur commented Oct 5, 2015

FYI: Ran JSON tests on IE6 and IE7 and worked. Not all other tests don't work because they are not compatible with older browsers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants