Skip to content

Commit

Permalink
Merge pull request #2109 from hmdne/chrome-38
Browse files Browse the repository at this point in the history
Restore compatibility with Chrome 38
  • Loading branch information
elia committed Jan 22, 2021
2 parents 480cdb1 + 4abc1ef commit f1b3c70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion opal/corelib/runtime.js
Expand Up @@ -1918,7 +1918,11 @@

// Assign the 'length' value with defineProperty because
// in strict mode the property is not writable.
Object.defineProperty(alias, 'length', { value: body.length });
// It doesn't work in older browsers (like Chrome 38), where
// an exception is thrown breaking Opal altogether.
try {
Object.defineProperty(alias, 'length', { value: body.length });
} catch (e) {}

// Try to make the browser pick the right name
alias.displayName = name;
Expand Down

0 comments on commit f1b3c70

Please sign in to comment.