Ensure reThis isn't used in Windows 8 apps.

This commit is contained in:
John-David Dalton
2013-09-19 08:53:19 -07:00
parent c2da0070f5
commit 7c6865f948
7 changed files with 131 additions and 93 deletions

View File

@@ -69,7 +69,7 @@
var reNoMatch = /($^)/;
/** Used to detect functions containing a `this` reference */
var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis;
var reThis = /\bthis\b/;
/** Used to match unescaped characters in compiled string literals */
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
@@ -716,6 +716,14 @@
*/
support.fastBind = nativeBind && !isV8;
/**
* Detect if functions can be decompiled by `Function#toString`
* (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
*
* @memberOf _.support
* @type boolean
*/
support.funcDecomp = !reNative.test(context.WinRTError) && reThis.test(runInContext);
/**
* Detect if `Function#name` is supported (all but IE).
@@ -1089,7 +1097,7 @@
}
if (support.funcNames || !bindData) {
// checks if `func` references the `this` keyword and stores the result
bindData = !reThis || reThis.test(source);
bindData = !support.funcDecomp || reThis.test(source);
setBindData(func, bindData);
}
}
@@ -6195,7 +6203,7 @@
if (data) {
return result(data);
}
// provide the compiled function's source via its `toString` method, in
// provide the compiled function's source by its `toString` method, in
// supported environments, or the `source` property as a convenience for
// inlining compiled templates during the build process
result.source = source;
@@ -6659,7 +6667,7 @@
// Expose Lo-Dash to the global object even when an AMD loader is present in
// case Lo-Dash was injected by a third-party script and not intended to be
// loaded as a module. The global assignment can be reverted in the Lo-Dash
// module via its `noConflict()` method.
// module by its `noConflict()` method.
root._ = _;
// define as an anonymous module so, through path mapping, it can be