summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-30 00:31:00 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-30 00:31:00 +0000
commitdc5641794fb5f511ca74d1d7392ccc29210ea9cd (patch)
treee21e50036a3fd053a512839a83463536854d2e81 /chrome/renderer
parent6b4e3017caa37d0bf760f79292e8cc867b2f4ec9 (diff)
downloadchromium_src-dc5641794fb5f511ca74d1d7392ccc29210ea9cd.zip
chromium_src-dc5641794fb5f511ca74d1d7392ccc29210ea9cd.tar.gz
chromium_src-dc5641794fb5f511ca74d1d7392ccc29210ea9cd.tar.bz2
BUG=12192
R=aa Review URL: http://codereview.chromium.org/115681 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/extensions/event_bindings.cc4
-rw-r--r--chrome/renderer/extensions/extension_api_client_unittest.cc2
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc1
-rw-r--r--chrome/renderer/js_only_v8_extensions.cc10
-rw-r--r--chrome/renderer/js_only_v8_extensions.h6
-rw-r--r--chrome/renderer/render_thread.cc1
-rw-r--r--chrome/renderer/renderer_resources.grd2
-rw-r--r--chrome/renderer/resources/event_bindings.js2
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js7
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js9
10 files changed, 15 insertions, 29 deletions
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
index 06479dc..19a9245 100644
--- a/chrome/renderer/extensions/event_bindings.cc
+++ b/chrome/renderer/extensions/event_bindings.cc
@@ -41,8 +41,6 @@ int EventDecrementListenerCount(const std::string& event_name) {
return --(data->listener_count[event_name]);
}
-
-const char* kExtensionDeps[] = { JsonJsV8Extension::kName };
const char* kContextAttachCount = "chromium.attachCount";
class ExtensionImpl : public v8::Extension {
@@ -50,7 +48,7 @@ class ExtensionImpl : public v8::Extension {
ExtensionImpl()
: v8::Extension(EventBindings::kName,
GetStringResource<IDR_EVENT_BINDINGS_JS>(),
- arraysize(kExtensionDeps), kExtensionDeps) {
+ 0, NULL) {
}
~ExtensionImpl() {}
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 9689d95..ddc7c42 100644
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -71,7 +71,7 @@ TEST_F(ExtensionAPIClientTest, CallbackDispatching) {
"}"
"function callback(result) {"
" assert(typeof result == 'object', 'result not object');"
- " assert(goog.json.serialize(result) == '{\"foo\":\"bar\"}', "
+ " assert(JSON.stringify(result) == '{\"foo\":\"bar\"}', "
" 'incorrect result');"
" console.log('pass')"
"}"
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 96f0256..6057a3e 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -25,7 +25,6 @@ const char kExtensionName[] = "chrome/ExtensionProcessBindings";
const char* kExtensionDeps[] = {
BaseJsV8Extension::kName,
EventBindings::kName,
- JsonJsV8Extension::kName,
JsonSchemaJsV8Extension::kName,
RendererExtensionBindings::kName,
};
diff --git a/chrome/renderer/js_only_v8_extensions.cc b/chrome/renderer/js_only_v8_extensions.cc
index d304ef1..577f170 100644
--- a/chrome/renderer/js_only_v8_extensions.cc
+++ b/chrome/renderer/js_only_v8_extensions.cc
@@ -15,16 +15,6 @@ v8::Extension* BaseJsV8Extension::Get() {
0, NULL);
}
-// JsonJsV8Extension
-const char* JsonJsV8Extension::kName = "chrome/json";
-v8::Extension* JsonJsV8Extension::Get() {
- static const char* deps[] = {
- BaseJsV8Extension::kName
- };
- return new v8::Extension(kName, GetStringResource<IDR_DEVTOOLS_JSON_JS>(),
- arraysize(deps), deps);
-}
-
// JsonSchemaJsV8Extension
const char* JsonSchemaJsV8Extension::kName = "chrome/jsonschema";
v8::Extension* JsonSchemaJsV8Extension::Get() {
diff --git a/chrome/renderer/js_only_v8_extensions.h b/chrome/renderer/js_only_v8_extensions.h
index 771103e..2fdb8af 100644
--- a/chrome/renderer/js_only_v8_extensions.h
+++ b/chrome/renderer/js_only_v8_extensions.h
@@ -16,12 +16,6 @@ class BaseJsV8Extension {
static v8::Extension* Get();
};
-class JsonJsV8Extension {
- public:
- static const char* kName;
- static v8::Extension* Get();
-};
-
class JsonSchemaJsV8Extension {
public:
static const char* kName;
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 0412b94..844bd90 100644
--- a/chrome/renderer/render_thread.cc
+++ b/chrome/renderer/render_thread.cc
@@ -345,7 +345,6 @@ void RenderThread::EnsureWebKitInitialized() {
// only so that we don't have to gate these on --enable-extensions.
if (command_line.HasSwitch(switches::kEnableExtensions)) {
WebKit::registerExtension(BaseJsV8Extension::Get());
- WebKit::registerExtension(JsonJsV8Extension::Get());
WebKit::registerExtension(JsonSchemaJsV8Extension::Get());
WebKit::registerExtension(EventBindings::Get());
WebKit::registerExtension(RendererExtensionBindings::Get());
diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd
index cda253b..c59e98c 100644
--- a/chrome/renderer/renderer_resources.grd
+++ b/chrome/renderer/renderer_resources.grd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This comment is only here because changes to resources are not picked up
-without changes to the corresponding grd file. -->
+without changes to the corresponding grd file. -->
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/renderer_resources.h" type="rc_header">
diff --git a/chrome/renderer/resources/event_bindings.js b/chrome/renderer/resources/event_bindings.js
index 6fcdd00..f11ec78 100644
--- a/chrome/renderer/resources/event_bindings.js
+++ b/chrome/renderer/resources/event_bindings.js
@@ -35,7 +35,7 @@ var chrome = chrome || {};
chrome.Event.dispatchJSON_ = function(name, args) {
if (chrome.Event.attached_[name]) {
if (args) {
- args = goog.json.parse(args);
+ args = JSON.parse(args);
}
chrome.Event.attached_[name].dispatch.apply(
chrome.Event.attached_[name], args);
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index 5a9fcf1..d025f7b 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -86,7 +86,7 @@ var chrome;
if (callbacks[requestId]) {
if (response) {
- callbacks[requestId](goog.json.parse(response));
+ callbacks[requestId](JSON.parse(response));
} else {
callbacks[requestId]();
}
@@ -98,7 +98,10 @@ var chrome;
// Send an API request and optionally register a callback.
function sendRequest(request, args, callback) {
- var sargs = goog.json.serialize(args);
+ // JSON.stringify doesn't support a root object which is undefined.
+ if (args === undefined)
+ args = null;
+ var sargs = JSON.stringify(args);
var requestId = GetNextRequestId();
var hasCallback = false;
if (callback) {
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 667b97d..cc232b4 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -33,7 +33,7 @@ var chrome = chrome || {};
chrome.Port.dispatchOnConnect_ = function(portId, tab) {
var port = new chrome.Port(portId);
if (tab) {
- tab = goog.json.parse(tab);
+ tab = JSON.parse(tab);
}
port.tab = tab;
chrome.Event.dispatch_("channel-connect", [port]);
@@ -44,7 +44,7 @@ var chrome = chrome || {};
var port = chrome.Port.ports_[portId];
if (port) {
if (msg) {
- msg = goog.json.parse(msg);
+ msg = JSON.parse(msg);
}
port.onMessage.dispatch(msg, port);
}
@@ -53,7 +53,10 @@ var chrome = chrome || {};
// Sends a message asynchronously to the context on the other end of this
// port.
chrome.Port.prototype.postMessage = function(msg) {
- PostMessage(this.portId_, goog.json.serialize(msg));
+ // JSON.stringify doesn't support a root object which is undefined.
+ if (msg === undefined)
+ msg = null;
+ PostMessage(this.portId_, JSON.stringify(msg));
};
// Extension object.