FLUID-4941: Infusion's event system throws an error when Prototype.js is included in a web page

Metadata

Source
FLUID-4941
Type
Bug
Priority
Critical
Status
Closed
Resolution
Fixed
Assignee
Antranig Basman
Reporter
Colin Clark
Created
2013-03-21T15:57:14.956-0400
Updated
2014-04-04T15:22:45.479-0400
Versions
  1. 1.4
Fixed Versions
  1. 1.5
Component
  1. Framework

Description

Prototype.js is still doing shady things with the prototypes of built-in types such as Array. In particular, it extends Array.prototype by adding an "each" method to it.

In Infusion 1.4's implementation of fireToListeners (defined inside fluid.event.getEventFirer), we use a for..in statement to iterate over the keys in an Array. This statement does not filter based on hasOwnProperty, and as a result will include Prototype's each property in the keys it operates on.

The fix is to use a regular for statement to iterate over values in the array of listeners rather than not use for..in.

This issue has been fixed in master, but is causing problems for uPortal users who want to include Prototype.js in their portlets.

Environments

All browsers

Comments

  • Colin Clark commented 2013-03-21T16:13:03.372-0400

    This issue is fixed in the current Infusion master branch and will be released along with Infusion 1.5 (or whatever version it ends up being).