diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-08-05 16:02:47 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-08-05 16:02:47 (GMT) |
commit | a0fecb437176786e9c809a45e64351516b05a201 (patch) | |
tree | dba10b91d8104aad7896a766462899e589b9144b /src | |
parent | 43ab9a27363681c5db81004c95141b3d0695cabd (diff) | |
download | Qt-a0fecb437176786e9c809a45e64351516b05a201.zip Qt-a0fecb437176786e9c809a45e64351516b05a201.tar.gz Qt-a0fecb437176786e9c809a45e64351516b05a201.tar.bz2 |
RegExp.prototype.toString() when pattern is empty
Like ECMA-262 says, // starts a single-line comment;
/(?:)/ represents an empty regular expression.
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp index b1ab889..e507016 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -106,6 +106,10 @@ JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValu } UString result = "/" + asRegExpObject(thisValue)->get(exec, exec->propertyNames().source).toString(exec); +#ifdef QT_BUILD_SCRIPT_LIB + if (result.size() == 1) + result.append("(?:)"); +#endif result.append('/'); if (asRegExpObject(thisValue)->get(exec, exec->propertyNames().global).toBoolean(exec)) result.append('g'); |