[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
barraclough at apple.com
barraclough at apple.com
Fri Feb 26 22:14:55 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c224e0cee56859fe67005c3371859cc79bc55ac8
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Feb 8 23:04:34 2010 +0000
Switch some more StringBuilder/jsNontrivialString code to use
JSStringBuilder/jsMakeNontrivialString - these methods will
throw an exception if we hit out-of-memory, rather than just
CRASHing.
Reviewed by Geoff Garen.
* runtime/FunctionPrototype.cpp:
(JSC::functionProtoFuncToString):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::encode):
(JSC::decode):
(JSC::globalFuncEscape):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 72ca25f..165f2f6 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,21 @@
2010-02-08 Gavin Barraclough <barraclough at apple.com>
+ Reviewed by Geoff Garen.
+
+ Switch some more StringBuilder/jsNontrivialString code to use
+ JSStringBuilder/jsMakeNontrivialString - these methods will
+ throw an exception if we hit out-of-memory, rather than just
+ CRASHing.
+
+ * runtime/FunctionPrototype.cpp:
+ (JSC::functionProtoFuncToString):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::decode):
+ (JSC::globalFuncEscape):
+
+2010-02-08 Gavin Barraclough <barraclough at apple.com>
+
Reviewed by Sam Weinig.
Use an empty identifier instead of a null identifier for parse
diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp
index bb6b579..3475f08 100644
--- a/JavaScriptCore/runtime/FunctionPrototype.cpp
+++ b/JavaScriptCore/runtime/FunctionPrototype.cpp
@@ -25,6 +25,7 @@
#include "JSArray.h"
#include "JSFunction.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "Interpreter.h"
#include "Lexer.h"
#include "PrototypeFunction.h"
@@ -90,13 +91,13 @@ JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSVa
FunctionExecutable* executable = function->jsExecutable();
UString sourceString = executable->source().toString();
insertSemicolonIfNeeded(sourceString);
- return jsString(exec, makeString("function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString);
}
}
if (thisValue.inherits(&InternalFunction::info)) {
InternalFunction* function = asInternalFunction(thisValue);
- return jsString(exec, makeString("function ", function->name(exec), "() {\n [native code]\n}"));
+ return jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}");
}
return throwError(exec, TypeError);
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 0bc1274..e5e58d0 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -30,11 +30,11 @@
#include "Interpreter.h"
#include "JSGlobalObject.h"
#include "JSString.h"
+#include "JSStringBuilder.h"
#include "Lexer.h"
#include "LiteralParser.h"
#include "Nodes.h"
#include "Parser.h"
-#include "StringBuilder.h"
#include "StringExtras.h"
#include "dtoa.h"
#include <stdio.h>
@@ -57,7 +57,7 @@ static JSValue encode(ExecState* exec, const ArgList& args, const char* doNotEsc
if (!cstr.c_str())
return throwError(exec, URIError, "String contained an illegal UTF-16 sequence.");
- StringBuilder builder;
+ JSStringBuilder builder;
const char* p = cstr.c_str();
for (size_t k = 0; k < cstr.size(); k++, p++) {
char c = *p;
@@ -69,12 +69,12 @@ static JSValue encode(ExecState* exec, const ArgList& args, const char* doNotEsc
builder.append((const char*)tmp);
}
}
- return jsString(exec, builder.release());
+ return builder.releaseJSString(exec);
}
static JSValue decode(ExecState* exec, const ArgList& args, const char* doNotUnescape, bool strict)
{
- StringBuilder builder;
+ JSStringBuilder builder;
UString str = args.at(0).toString(exec);
int k = 0;
int len = str.size();
@@ -135,7 +135,7 @@ static JSValue decode(ExecState* exec, const ArgList& args, const char* doNotUne
k++;
builder.append(c);
}
- return jsString(exec, builder.release());
+ return builder.releaseJSString(exec);
}
bool isStrWhiteSpace(UChar c)
@@ -378,8 +378,7 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec, JSObject*, JSValue, cons
"0123456789"
"*+-./@_";
- StringBuilder builder;
- UString s;
+ JSStringBuilder builder;
UString str = args.at(0).toString(exec);
const UChar* c = str.data();
for (int k = 0; k < str.size(); k++, c++) {
@@ -387,18 +386,17 @@ JSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec, JSObject*, JSValue, cons
if (u > 255) {
char tmp[7];
sprintf(tmp, "%%u%04X", u);
- s = UString(tmp);
+ builder.append((const char*)tmp);
} else if (u != 0 && strchr(do_not_escape, static_cast<char>(u)))
- s = UString(c, 1);
+ builder.append(c, 1);
else {
char tmp[4];
sprintf(tmp, "%%%02X", u);
- s = UString(tmp);
+ builder.append((const char*)tmp);
}
- builder.append(s);
}
- return jsString(exec, builder.release());
+ return builder.releaseJSString(exec);
}
JSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec, JSObject*, JSValue, const ArgList& args)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list