WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37125 closed defect (bug) (fixed)

Shiny Updates: postMessage and browser extensions conflict

Reported by: afercia Owned by: swissspidy
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.9
Component: Upgrade/Install Keywords: has-patch
Focuses: javascript Cc:

Description (last modified by afercia)

Noticed in Chrome, using the "Accessibility Developer Tools" extension, see https://github.com/GoogleChrome/accessibility-developer-tools-extension

Looks like some browser extensions may use postMessage and conflict with the updates postMessage events:

https://cldup.com/57EOl9W2a0.png

In this case, the "Accessibility Developer Tools" extension triggers two "message" events when opening the plugin details modal and passes as data an object.

Maybe, in 'updates.js' it would be safer to check if the event data is a string before trying to parse it because this line:
message = $.parseJSON( originalEvent.data );
assumes originalEvent.data is a well-formed JSON string while browser extensions or maybe also plugins might pass other types of data.

Attachments (1)

37125.diff (415 bytes) - added by swissspidy 4 years ago.

Download all attachments as: .zip

Change History (8)

This ticket was mentioned in Slack in #feature-shinyupdates by swissspidy. View the logs.


4 years ago

#2 @afercia
4 years ago

  • Description modified (diff)

#3 @swissspidy
4 years ago

  • Component changed from Plugins to Upgrade/Install
  • Milestone changed from Awaiting Review to 4.6
  • Owner set to swissspidy
  • Status changed from new to assigned

We might be able to use wp.updates.isValidResponse() inside the postMessage handler.

This ticket was mentioned in Slack in #feature-shinyupdates by swissspidy. View the logs.


4 years ago

#5 @swissspidy
4 years ago

  • Keywords needs-patch added
  • Summary changed from Plugin updates postMessage and browser extensions conflict to Shiny Updates: postMessage and browser extensions conflict

@swissspidy
4 years ago

#6 @swissspidy
4 years ago

  • Keywords has-patch added; needs-patch removed

Actually, a simple try {} catch() {} is enough.

#7 @swissspidy
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [37976]

Note: See TracTickets for help on using tickets.