tracker issue : CF-4207245

select a category, or use search below
(searches all categories and all time range)

Recent update to cfajax.js uses defineProperty method which is not available in IE 11 document mode 5

| View in Tracker

Status/Resolution/Reason: Open//

Reporter/Name(from Bugbase): JJ B. / ()

Created: 02/20/2020

Components: AJAX

Versions: 2016

Failure Type: Usability Issue

Found In Build/Fixed In Build: Cold Fusion 2016.0.13.316217 /

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 1

Problem Description:
The recent script added to the top of cfajax.js which tries to define "startsWith", fails in IE 11 Doc Mode 5 and throws a script error because the method "defineProperty" is not defined. After the script fails (at the top of the file), the ColdFusion js object is never defined and is not available for use by other Adobe-level cf.js files or by other end-user scripts. This only happens in Doc Mode 5 and CF Update 12 or later. We confirmed the failure in  CF2016 Update 13 and success in Update 11. But we believe U12 is where it was added (but could have been Update 13).

Steps to Reproduce:
Run any page which loads cfajax.js in the browser and a script error will appear as a popup or in the dev tools. This completely kills the operation of other functions that depend on the ColdFusion object in js as-is. So a work around or removal of the new script block is required for the app to function.

Any Workarounds:
We found an article that adds a custom defineProperty method so the code can then be executed without error. I'm not 100% sure this will restore all functionality, but it does not error and appears to establish the ColdFusion object.


We added the following code above the new section of cfajax.js (around line 9).
(function() {
  if (!Object.defineProperty ||
      !(function () { try { Object.defineProperty({}, 'x', {}); return true; } catch (e) { return false; } } ())) {
    var orig = Object.defineProperty;
    Object.defineProperty = function (o, prop, desc) {
      // In IE8 try built-in implementation for defining properties on DOM prototypes.
      if (orig) { try { return orig(o, prop, desc); } catch (e) {} }

      if (o !== Object(o)) { throw TypeError("Object.defineProperty called on non-object"); }
      if (Object.prototype.__defineGetter__ && ('get' in desc)) {, prop, desc.get);
      if (Object.prototype.__defineSetter__ && ('set' in desc)) {, prop, desc.set);
      if ('value' in desc) {
        o[prop] = desc.value;
      return o;