Skip to content

Commit

Permalink
Merge pull request #2428 from jgoz/fix-actions-undefined-descriptor
Browse files Browse the repository at this point in the history
[addon-actions] Check result of getPropertyDescriptor for IE11
  • Loading branch information
Hypnosphi committed Dec 5, 2017
2 parents 1db950d + 1813b89 commit 267b90a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/actions/src/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ export function action(name) {
});
};

// IE11 may return an undefined descriptor, but it supports Function#name
const nameDescriptor = Object.getOwnPropertyDescriptor(handler, 'name');
// This condition is true in modern browsers that implement Function#name properly
const canConfigureName = Object.getOwnPropertyDescriptor(handler, 'name').configurable;
const canConfigureName = !nameDescriptor || nameDescriptor.configurable;

if (canConfigureName && name && typeof name === 'string') {
Object.defineProperty(handler, 'name', { value: name });
Expand Down

0 comments on commit 267b90a

Please sign in to comment.