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

Correctly pretty print objects from other contexts (e.g. iframes) and which do not override toString #1091

Merged
merged 1 commit into from
Sep 27, 2016
Merged

Correctly pretty print objects from other contexts (e.g. iframes) and which do not override toString #1091

merged 1 commit into from
Sep 27, 2016

Conversation

thatfulvioguy
Copy link
Contributor

Fixes #1087

The issue in question was caused by globals (including prototypes and functions on them) having different identities in different contexts (e.g. iframes and web workers), therefore making value.toString !== Object.prototype.toString where value is from another context. The approach taken here is to compare the result of the value's toString with Object.prototype.toString to see if they really are different. If they differ, then the value definitely has a custom toString.

@thatfulvioguy
Copy link
Contributor Author

Hang on, I've just found that foreign-context arrays are being misprinted for similar reasons, caused by the existing value instanceof Array check that should be replaced. I'll quickly fix that and cover that case in the tests.

@thatfulvioguy
Copy link
Contributor Author

Fixing the printing of foreign-context arrays was trivial. However, writing a test for that without creating another context and ensuring that it also works in IE8 seems to be impossible, as far as I'm aware.

Is this PR sufficient as-is or do I need to do something more creative to test that part?

@thatfulvioguy
Copy link
Contributor Author

Is there anything preventing this PR from being merged?

@thatfulvioguy
Copy link
Contributor Author

Any news on this? We've had to create an internal fork with this PR and we'd rather not have it exist for too long.

@slackersoft slackersoft merged commit 2710bdf into jasmine:master Sep 27, 2016
slackersoft pushed a commit that referenced this pull request Sep 27, 2016
…/thatfulvioguy/jasmine into thatfulvioguy-pretty-print-cross-frame-objects

- Merges #1091 from @thatfulvioguy
- Fixes #1087
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.

None yet

2 participants