duckduckgo / zeroclickinfo-goodies

DuckDuckGo Instant Answers based on Perl & JavaScript
https://duckduckhack.com/
Other
978 stars 1.77k forks source link

Eclipse IDE Cheat Sheet: It's throwing a JS Error #1646

Closed bsstoner closed 8 years ago

bsstoner commented 8 years ago

screen shot 2015-10-08 at 5 06 25 pm


IA Page: http://duck.co/ia/view/eclipse_cheat_sheet

moollaza commented 8 years ago

@bsstoner I'm unable to re-create this, but I don't think anything has changed. All the cheatsheets run the same JS so if there's a bug, we should see it for all Cheat Sheets.

Are you still able to produce this?

preemeijer commented 8 years ago

I also tried it right now and I also can't reproduce the error...

mintsoft commented 8 years ago

@bsstoner @moollaza I've just reproduced it here: image on Vivaldi 1.0.291.18 (Developer Build) (32-bit) windows; although I doubt that's significant:

image

mintsoft commented 8 years ago

@bsstoner @moollaza now I've expanded it I think it's that this is commented out and the JSON contains */: image

image

moollaza commented 8 years ago

@mintsoft great find! I've confirmed this as well. It only happens in Chrome for me. Firefox seems to be OK. The problem is that our commented out script tag is being in-commented by the */ characters in the Cheat Sheets JSON.

developer_tools_-_https___duckduckgo_com__q_eclipse_cheat_sheet_ia_cheatsheet_iax_1_and_eclipse_cheat_sheet_at_duckduckgo

@bsstoner I'd say this is an internal (or browser) bug? Is there a reason we have that script tag commented out like that?

mintsoft commented 8 years ago

@moollaza I think the problem is basically "javascript comment injection", it looks like to me like the script tag on the page is commenting out the content of the JSON (for some reason) and https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/share/goodie/cheat_sheets/json/eclipse.json#L388 isuncommenting it?

That is to say, I don't think it's a browser bug, I think we're doing a weird thing!

moollaza commented 8 years ago

That is to say, I don't think it's a browser bug, I think we're doing a weird thing!

@mintsoft what's odd though is that Firefox seems to ignore the */ in the JSON. I'm not sure if that's Firefox making a mistake, or being clever. I didn't check Safari yet though...

moollaza commented 8 years ago

Yup, breaks in Safari as well.

mintsoft commented 8 years ago

@moollaza hmm yeah, I guess it feels a little like it's a bug in Firefox to me! I don't see why it wouldn't break

tagawa commented 8 years ago

Closing, as it looks like @Mailkov's PR fixed this.