summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-26 07:33:37 +0000
committersgjesse@chromium.org <sgjesse@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-26 07:33:37 +0000
commit9b9c52adbc082087ae7824d714d9d30b7a9bfd59 (patch)
tree693817af34f0bd8da6a3b0e6b5c5e8ffef271e66
parentd41c814d52f0f1700df7c6ba2c30a55680c6e6d7 (diff)
downloadchromium_src-9b9c52adbc082087ae7824d714d9d30b7a9bfd59.zip
chromium_src-9b9c52adbc082087ae7824d714d9d30b7a9bfd59.tar.gz
chromium_src-9b9c52adbc082087ae7824d714d9d30b7a9bfd59.tar.bz2
Support context data in form of a string
WbeKit bug 31873 (https://bugs.webkit.org/show_bug.cgi?id=31873) changes the context "data" from a JavaScript object to a string. This c$ BUG=23058 TEST=none Review URL: http://codereview.chromium.org/443002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33197 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js28
-rw-r--r--webkit/glue/devtools/js/devtools_host_stub.js7
2 files changed, 29 insertions, 6 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index ec22cc4..1aa91a8 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -983,7 +983,18 @@ devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_ = function(
if (this.contextId_ === null) {
return true;
}
- return (scriptContextId.value == this.contextId_);
+ if (goog.isString(context.data)) {
+ // Find the id from context data. The context data has the format "type,id".
+ var comma = context.data.indexOf(',');
+ if (comma < 0) {
+ return false;
+ }
+ return (parseInt(context.data.substring(comma + 1)) == this.contextId_);
+ } else {
+ // TODO(sgjesse) remove this when patch for
+ // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium.
+ return (scriptContextId.value == this.contextId_);
+ }
};
@@ -1075,7 +1086,20 @@ devtools.DebuggerAgent.prototype.didGetNextLogLines_ = function(log) {
*/
devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) {
var context = msg.lookup(script.context.ref);
- var contextType = context.data.type;
+ var contextType;
+ if (goog.isString(context.data)) {
+ // Find the type from context data. The context data has the format
+ // "type,id".
+ var comma = context.data.indexOf(',');
+ if (comma < 0) {
+ return
+ }
+ contextType = context.data.substring(0, comma);
+ } else {
+ // TODO(sgjesse) remove this when patch for
+ // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium.
+ contextType = context.data.type;
+ }
this.parsedScripts_[script.id] = new devtools.ScriptInfo(
script.id, script.name, script.lineOffset, contextType);
if (this.scriptsPanelInitialized_) {
diff --git a/webkit/glue/devtools/js/devtools_host_stub.js b/webkit/glue/devtools/js/devtools_host_stub.js
index 3dd2d78..9a90d04 100644
--- a/webkit/glue/devtools/js/devtools_host_stub.js
+++ b/webkit/glue/devtools/js/devtools_host_stub.js
@@ -181,8 +181,7 @@ RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) {
'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
'"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' +
'"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' +
- '"handle":60,"type":"context","data":{"type":"page","value":3}}],' +
- '"running":false}';
+ '"handle":60,"type":"context","data":"page,3"}],"running":false}';
this.sendResponse_(response1);
} else if ('{"seq":3,"type":"request","command":"scripts","arguments":{' +
'"ids":[59],"includeSource":true}}' == cmd) {
@@ -192,8 +191,8 @@ RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) {
'"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
'"lineCount":1,"source":"function fib(n) {return n+1;}",' +
'"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' +
- '"ref":0}}],"refs":[{"handle":0,"type":"context","data":{"type":' +
- '"page","value":3}}],"running":false}');
+ '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' +
+ '"running":false}');
} else {
debugPrint('Unexpected command: ' + cmd);
}