Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Change object construction to prevent Chrome v32 crashing. #1429

Merged
merged 1 commit into from

2 participants

Tate Johnson Iskren Ivov Chernev
Tate Johnson

We were getting reports that our website was crashing in Chrome. We were able to pinpoint it to moment.

Changing the config from a literal object to setting properties is ugly, but resolves the issue for us in production. Given how frequently Chrome is updated I suspect we'll be able to revert it once it's fixed upstream.

See #1423.

Tate Johnson tatey Change object construction to prevent Chrome v32 crashing.
Suspected JS execution optimizations in v32 is causing the browser to
throw "Aw, Snap".

See moment#1423
080c731
Iskren Ivov Chernev
Owner

Thank you for troubleshooting and patching this. Can you please submit and link a chrome bug for this?

Iskren Ivov Chernev ichernev merged commit b92af0d into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 20, 2014
  1. Tate Johnson

    Change object construction to prevent Chrome v32 crashing.

    tatey authored
    Suspected JS execution optimizations in v32 is causing the browser to
    throw "Aw, Snap".
    
    See moment#1423
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 22 deletions.
  1. +28 −22 moment.js
50 moment.js
View
@@ -1576,41 +1576,47 @@
}
moment = function (input, format, lang, strict) {
+ var c;
+
if (typeof(lang) === "boolean") {
strict = lang;
lang = undefined;
}
- return makeMoment({
- _isAMomentObject: true,
- _i : input,
- _f : format,
- _l : lang,
- _strict : strict,
- _isUTC : false,
- _pf : defaultParsingFlags()
- });
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c = {};
+ c._isAMomentObject = true;
+ c._i = input;
+ c._f = format;
+ c._l = lang;
+ c._strict = strict;
+ c._isUTC = false;
+ c._pf = defaultParsingFlags();
+
+ return makeMoment(c);
};
// creating with utc
moment.utc = function (input, format, lang, strict) {
- var m;
+ var c;
if (typeof(lang) === "boolean") {
strict = lang;
lang = undefined;
}
- m = makeMoment({
- _isAMomentObject: true,
- _useUTC : true,
- _isUTC : true,
- _l : lang,
- _i : input,
- _f : format,
- _strict : strict,
- _pf : defaultParsingFlags()
- }).utc();
-
- return m;
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c = {};
+ c._isAMomentObject = true;
+ c._useUTC = true;
+ c._isUTC = true;
+ c._l = lang;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+ c._pf = defaultParsingFlags();
+
+ return makeMoment(c).utc();
};
// creating with unix timestamp (in seconds)
Something went wrong with that request. Please try again.