summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/RegExpPrototype.cpp4
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp2
2 files changed, 4 insertions, 2 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');
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index ec84406..7f22316 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -508,12 +508,10 @@ void tst_QScriptEngine::newRegExp()
QScriptValue r9 = rxCtor.construct();
QVERIFY(r9.isRegExp());
- QEXPECT_FAIL("", "JSC: String representation of regexp with empty pattern is wrong", Continue);
QCOMPARE(r9.toString(), QString::fromLatin1("/(?:)/"));
QScriptValue r10 = rxCtor.construct(QScriptValueList() << "" << "gim");
QVERIFY(r10.isRegExp());
- QEXPECT_FAIL("", "JSC: String representation of regexp with empty pattern is wrong", Continue);
QCOMPARE(r10.toString(), QString::fromLatin1("/(?:)/gim"));
QScriptValue r11 = rxCtor.construct(QScriptValueList() << "{1.*}" << "g");