Opened 13 years ago
Closed 13 years ago
#26174 closed defect (bug) (fixed)
Customizer postMessage listener throws errors if it encounters a non-JSON string
| Reported by: | mattwiebe | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.8 |
| Component: | Customize | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description
Our postMessage listener in wp-includes/js/customize-base.js assumes that every possible postMessage message that comes in from the same domain as the Customizer must have an event.data property that is 1) a string and 2) a good candidate for JSON.parse.
Both of these assumptions are faulty, since 1) non-IE browsers can pass objects, not just strings, and 2) sending a string that can't be JSON.parse'd is a perfectly valid thing to do. As more things start to use postMessage, this will get us into more trouble. (In this case it's Google+ Follow embeds, which receive "lovely" strings like "!_{h:'I0_1385142794503'}" which JSON.parse of course chokes on.
Patch included.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Bad paste. Fixed in [26542].