summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 10:02:16 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-02 10:02:16 +0000
commit54b004dbd789fab3761f61dbb791abf0dd79bfaf (patch)
tree73f672efe88c328601bca01fa3b10df1a444c1c7 /webkit/glue
parent79b353feeec521dcf3ebdd8fc7e4648c61c071e2 (diff)
downloadchromium_src-54b004dbd789fab3761f61dbb791abf0dd79bfaf.zip
chromium_src-54b004dbd789fab3761f61dbb791abf0dd79bfaf.tar.gz
chromium_src-54b004dbd789fab3761f61dbb791abf0dd79bfaf.tar.bz2
DevTools: Remove context functions that are not available in InjectedScript.js upstream.
Review URL: http://codereview.chromium.org/191003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/devtools/js/inject.js102
1 files changed, 4 insertions, 98 deletions
diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js
index 5002dfb..8a9b199 100644
--- a/webkit/glue/devtools/js/inject.js
+++ b/webkit/glue/devtools/js/inject.js
@@ -44,101 +44,7 @@ InjectedScript._window = function() {
};
-Object.type = function(obj, win)
-{
- if (obj === null)
- return "null";
-
- var type = typeof obj;
- if (type !== "object" && type !== "function")
- return type;
-
- win = win || window;
-
- if (obj instanceof win.Node)
- return (obj.nodeType === undefined ? type : "node");
- if (obj instanceof win.String)
- return "string";
- if (obj instanceof win.Array)
- return "array";
- if (obj instanceof win.Boolean)
- return "boolean";
- if (obj instanceof win.Number)
- return "number";
- if (obj instanceof win.Date)
- return "date";
- if (obj instanceof win.RegExp)
- return "regexp";
- if (obj instanceof win.Error)
- return "error";
- return type;
-}
-
-// Temporarily moved into the injected context.
-Object.hasProperties = function(obj)
-{
- if (typeof obj === "undefined" || typeof obj === "null")
- return false;
- for (var name in obj)
- return true;
- return false;
-}
-
-Object.describe = function(obj, abbreviated)
-{
- var type1 = Object.type(obj);
- var type2 = (obj == null) ? "null" : obj.constructor.name;
-
- switch (type1) {
- case "object":
- case "node":
- return type2;
- case "array":
- return "[" + obj.toString() + "]";
- case "string":
- if (obj.length > 100)
- return "\"" + obj.substring(0, 100) + "\u2026\"";
- return "\"" + obj + "\"";
- case "function":
- var objectText = String(obj);
- if (!/^function /.test(objectText))
- objectText = (type2 == "object") ? type1 : type2;
- else if (abbreviated)
- objectText = /.*/.exec(obj)[0].replace(/ +$/g, "");
- return objectText;
- case "regexp":
- return String(obj).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1);
- default:
- return String(obj);
- }
-}
-
-Function.prototype.bind = function(thisObject)
-{
- var func = this;
- var args = Array.prototype.slice.call(arguments, 1);
- return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))) };
-}
-
-String.prototype.escapeCharacters = function(chars)
-{
- var foundChar = false;
- for (var i = 0; i < chars.length; ++i) {
- if (this.indexOf(chars.charAt(i)) !== -1) {
- foundChar = true;
- break;
- }
- }
-
- if (!foundChar)
- return this;
-
- var result = "";
- for (var i = 0; i < this.length; ++i) {
- if (chars.indexOf(this.charAt(i)) !== -1)
- result += "\\";
- result += this.charAt(i);
- }
-
- return result;
-}
+// Plugging into upstreamed support.
+Object.className = function(obj) {
+ return (obj == null) ? "null" : obj.constructor.name;
+};