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

Fix for complex applications. Uncaught TypeError: Cannot convert object to primitive value. #69

Closed
wants to merge 2 commits into from

Conversation

a904guy
Copy link

@a904guy a904guy commented Dec 31, 2015

Fixes Uncaught TypeError: Cannot convert object to primitive value found when executed on http://www.linkedIn.com/pulse/
Just let chrome handle return, it will result in the same outcome.

Expected Outcome (after fix):
image

Error encountered:
image

Fixes ``Uncaught TypeError: Cannot convert object to primitive value`` found when executed on linkedIn.com/pulse/
Just let chrome handle return, it will result in the same outcome.

Expected Outcome (after fix):
![image](https://cloud.githubusercontent.com/assets/404081/12068042/1967600a-afd3-11e5-8ead-8b9858b77fed.png)

Error encountered:
![image](https://cloud.githubusercontent.com/assets/404081/12068054/48c2f1ca-afd3-11e5-9635-986ca733d115.png)
@a904guy
Copy link
Author

a904guy commented Dec 31, 2015

@bgrins, 👍 ?

Simple fix really, allows working with more complex JavaScript frameworks.

@a904guy a904guy mentioned this pull request Jan 1, 2016
@bgrins
Copy link
Owner

bgrins commented Jan 5, 2016

I don't see the error when running the snippet on http://www.linkedIn.com/pulse/. I'm surprised that calling console.log was throwing an exception.. was this on canary?

@a904guy
Copy link
Author

a904guy commented Jan 5, 2016

Standard release. 47.0.2526.106 (64-bit) Linux, and Windows for me.

image

@a904guy
Copy link
Author

a904guy commented Jan 5, 2016

image

Will have to check to Windows version but considering they self update, I doubt it's much different.

@a904guy
Copy link
Author

a904guy commented Jan 5, 2016

Version 47.0.2526.106 m for Windows.

image

image

@a904guy
Copy link
Author

a904guy commented Jan 5, 2016

Using return

image

@bgrins
Copy link
Owner

bgrins commented Mar 21, 2016

This seems like a bug in chrome - I don't think console.log should ever throw. Do you have any extensions installed / do you see it on a clean profile? I'm just hesitant to land it because we have lots of other snippets that do console.log and if it's failing in certain cases this might bite all of them.

@a904guy
Copy link
Author

a904guy commented Mar 21, 2016

I'll have to check but considering the call stack it looks like it may just
be LinkedIn is binding to it and causing the issue (at eye glance didn't
dig deep into the "un-uglified" code), regardless, it is unnecessary code
for the snippet.

On Mon, Mar 21, 2016, 1:29 PM Brian Grinstead [email protected]
wrote:

This seems like a bug in chrome - I don't think console.log should ever
throw. Do you have any extensions installed / do you see it on a clean
profile? I'm just hesitant to land it because we have lots of other
snippets that do console.log and if it's failing in certain cases this
might bite all of them.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#69 (comment)

@bgrins
Copy link
Owner

bgrins commented Mar 22, 2016

it looks like it may just be LinkedIn is binding to it and causing the issue

Could be. Indeed, console is replaceable as per the spec: whatwg/console#1 (at least for now) so a page could do console.log = function() { throwSomething() }.

@bgrins
Copy link
Owner

bgrins commented Mar 22, 2016

Going to close this out since it sounds like that page is doing something weird, but thanks for filing and talking it out

@bgrins bgrins closed this Mar 22, 2016
@a904guy
Copy link
Author

a904guy commented Apr 6, 2016

I would still merge the modification, it works even if people tamper with console. So it is a better implementation. No?

@a904guy
Copy link
Author

a904guy commented Sep 15, 2016

It is obviously being overwritten by the error call stack, my point still stands, removing console.log improves the success rate of using the script, with the exact same outcome.

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.

2 participants