Diff
Modified: trunk/LayoutTests/ChangeLog (131177 => 131178)
--- trunk/LayoutTests/ChangeLog 2012-10-12 12:30:20 UTC (rev 131177)
+++ trunk/LayoutTests/ChangeLog 2012-10-12 12:36:03 UTC (rev 131178)
@@ -1,3 +1,14 @@
+2012-10-12 Pavel Feldman <[email protected]>
+
+ Web Inspector: relies on current Function.prototype.bind in the frame
+ https://bugs.webkit.org/show_bug.cgi?id=99164
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/console/command-line-api-expected.txt:
+ * inspector/console/console-bind-fake-expected.txt: Added.
+ * inspector/console/console-bind-fake.html: Added.
+
2012-10-12 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening, update expected files, skip new failing tests.
Modified: trunk/LayoutTests/inspector/console/command-line-api-expected.txt (131177 => 131178)
--- trunk/LayoutTests/inspector/console/command-line-api-expected.txt 2012-10-12 12:30:20 UTC (rev 131177)
+++ trunk/LayoutTests/inspector/console/command-line-api-expected.txt 2012-10-12 12:36:03 UTC (rev 131178)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 984: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
+CONSOLE MESSAGE: line 1020: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
Tests that command line api works.
Added: trunk/LayoutTests/inspector/console/console-bind-fake-expected.txt (0 => 131178)
--- trunk/LayoutTests/inspector/console/console-bind-fake-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/console/console-bind-fake-expected.txt 2012-10-12 12:36:03 UTC (rev 131178)
@@ -0,0 +1,5 @@
+Tests that overriding Function.prototype.bind does not break inspector.
+
+foo
+"fooValue"
+
Property changes on: trunk/LayoutTests/inspector/console/console-bind-fake-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/console/console-bind-fake.html (0 => 131178)
--- trunk/LayoutTests/inspector/console/console-bind-fake.html (rev 0)
+++ trunk/LayoutTests/inspector/console/console-bind-fake.html 2012-10-12 12:36:03 UTC (rev 131178)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+var foo = 'fooValue';
+
+Function.prototype.bind = function () { throw ":P"; };
+
+function test()
+{
+ InspectorTest.evaluateInConsole("foo", step1);
+
+ function step1()
+ {
+ InspectorTest.dumpConsoleMessages();
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that overriding Function.prototype.bind does not break inspector.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/console/console-bind-fake.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (131177 => 131178)
--- trunk/Source/WebCore/ChangeLog 2012-10-12 12:30:20 UTC (rev 131177)
+++ trunk/Source/WebCore/ChangeLog 2012-10-12 12:36:03 UTC (rev 131178)
@@ -1,3 +1,17 @@
+2012-10-12 Pavel Feldman <[email protected]>
+
+ Web Inspector: relies on current Function.prototype.bind in the frame
+ https://bugs.webkit.org/show_bug.cgi?id=99164
+
+ Reviewed by Yury Semikhatsky.
+
+ InjectedScriptSource should not depend on the bind override.
+
+ Test: inspector/console/console-bind-fake.html
+
+ * inspector/InjectedScriptSource.js:
+ (.):
+
2012-10-12 Alexander Pavlov <[email protected]>
Web Inspector: [Styles] Colors should be "As authored" by default
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (131177 => 131178)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2012-10-12 12:30:20 UTC (rev 131177)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2012-10-12 12:36:03 UTC (rev 131178)
@@ -34,6 +34,42 @@
(function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
/**
+ * @param {Arguments} array
+ * @param {number=} index
+ * @return {Array.<*>}
+ */
+function slice(array, index)
+{
+ var result = [];
+ for (var i = index || 0; i < array.length; ++i)
+ result.push(array[i]);
+ return result;
+}
+
+/**
+ * Please use this bind, not the one from Function.prototype
+ * @param {function()} func
+ * @param {Object} thisObject
+ * @param {...number} var_args
+ */
+function bind(func, thisObject, var_args)
+{
+ var args = slice(arguments, 2);
+
+ /**
+ * @param {...number} var_args
+ */
+ function bound(var_args)
+ {
+ return func.apply(thisObject, args.concat(slice(arguments)));
+ }
+ bound.toString = function() {
+ return "bound: " + func;
+ };
+ return bound;
+}
+
+/**
* @constructor
*/
var InjectedScript = function()
@@ -935,7 +971,7 @@
if (member in inspectedWindow || inScopeVariables(member))
continue;
- this[member] = commandLineAPIImpl[member].bind(commandLineAPIImpl);
+ this[member] = bind(commandLineAPIImpl[member], commandLineAPIImpl);
}
for (var i = 0; i < 5; ++i) {
@@ -943,7 +979,7 @@
if (member in inspectedWindow || inScopeVariables(member))
continue;
- this.__defineGetter__("$" + i, commandLineAPIImpl._inspectedObject.bind(commandLineAPIImpl, i));
+ this.__defineGetter__("$" + i, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl, i));
}
this.$_ = injectedScript._lastResult;