Changeset 146840 in webkit
- Timestamp:
- Mar 25, 2013 7:35:54 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146839 r146840 1 2013-03-25 Timothy Hatcher <timothy@apple.com> 2 3 Make the Web Inspector console work in strict mode with JavaScriptCore. 4 5 https://webkit.org/b/65829 6 rdar://problem/11271238 7 8 Reviewed by Oliver Hunt. 9 10 * inspector/debugger/mutation-observer-suspend-while-paused.html: Tweaked. 11 * inspector/console/command-line-api-expected.txt: Updated. 12 13 * platform/mac/http/tests/inspector/console-resource-errors-expected.txt: Added. 14 * platform/mac/http/tests/inspector/console-websocket-error-expected.txt: Updated. 15 * platform/mac/inspector/console/console-eval-syntax-error-expected.txt: Added. 16 * platform/mac/inspector/debugger/debugger-pause-in-eval-script-expected.txt: Added. 17 * platform/mac/inspector/extensions/extensions-eval-expected.txt: Added. 18 Added new expectations to match the new console evaluate approach. 19 1 20 2013-03-25 James Robinson <jamesr@chromium.org> 2 21 -
trunk/LayoutTests/inspector/console/command-line-api-expected.txt
r144950 r146840 1 CONSOLE MESSAGE: line 1 182: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")1 CONSOLE MESSAGE: line 1222: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s") 2 2 Tests that command line api works. 3 3 -
trunk/LayoutTests/inspector/debugger/mutation-observer-suspend-while-paused.html
r138754 r146840 8 8 { 9 9 var setup = 10 " var div = document.createElement('div');\n" +11 " vardeliveryCount = 0;\n" +10 "window.testDiv = document.createElement('div');\n" + 11 "window.deliveryCount = 0;\n" + 12 12 "var observer = new WebKitMutationObserver(function(records) {\n" + 13 " deliveryCount++;\n" +13 " window.deliveryCount++;\n" + 14 14 "});\n" + 15 "observer.observe( div, { attributes: true });";15 "observer.observe(window.testDiv, { attributes: true });"; 16 16 17 17 var mutateAndPause = 18 18 "function mutateAndPause() {\n" + 19 " div.setAttribute('foo', 'baz');\n" +19 " window.testDiv.setAttribute('foo', 'baz');\n" + 20 20 " debugger;\n" + 21 21 "};\n" + … … 34 34 function step2() 35 35 { 36 InspectorTest.evaluateInConsole(" div.setAttribute('foo', 'bar')", function() {36 InspectorTest.evaluateInConsole("window.testDiv.setAttribute('foo', 'bar')", function() { 37 37 InspectorTest.addResult("setAttribute should have triggered delivery."); 38 38 InspectorTest.evaluateInConsoleAndDump("deliveryCount", step3); -
trunk/LayoutTests/platform/mac/http/tests/inspector/console-websocket-error-expected.txt
r133351 r146840 8 8 9 9 testDNSLookup: Test started. console-websocket-error.html:32 10 WebSocket network error: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) ws://nonexistent.domain.invalid/10 WebSocket network error: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) http://127.0.0.1:8000/inspector/console-websocket-error.html 11 11 testDNSLookup: onclose is called. console-websocket-error.html:43 12 12 testSSLCertificate: Test started. console-websocket-error.html:50 13 WebSocket network error: OSStatus Error -9807: Invalid certificate chain wss://127.0.0.1:8443/13 WebSocket network error: OSStatus Error -9807: Invalid certificate chain http://127.0.0.1:8000/inspector/console-websocket-error.html 14 14 testSSLCertificate: onclose is called. console-websocket-error.html:64 15 15 -
trunk/Source/WebCore/ChangeLog
r146835 r146840 1 2013-03-25 Timothy Hatcher <timothy@apple.com> 2 3 Make the Web Inspector console work in strict mode with JavaScriptCore. 4 5 https://webkit.org/b/65829 6 rdar://problem/11271238 7 8 Reviewed by Oliver Hunt. 9 10 * bindings/js/JSInjectedScriptHostCustom.cpp: 11 (WebCore::JSInjectedScriptHost::evaluate): 12 Return the evalFunction directly. 13 14 * inspector/InjectedScriptHost.h: 15 (WebCore::InjectedScriptHost::evaluateReturnsEvalFunction): 16 Added. Return true on JSC and false on V8. 17 18 * inspector/InjectedScriptHost.idl: 19 Added evaluateReturnsEvalFunction and change evaluate to an attribute on JSC. 20 21 * inspector/InjectedScriptSource.js: 22 (InjectedScript.prototype._evaluateOn): Change from using 'with' statements to creating 23 a closure that evaluates the expression. The command line APIs are passed as parameters 24 to the closure so they are in scope but not injected. This allows the code evaluated in 25 the console to stay in strict mode (if is was already set), or to get strict mode by 26 prefixing expressions with 'use strict';. 27 1 28 2013-03-25 Tony Chang <tony@chromium.org> 2 29 -
trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r144950 r146840 286 286 } 287 287 288 JSValue JSInjectedScriptHost::evaluate(ExecState* exec) 289 { 290 JSValue expression = exec->argument(0); 291 if (!expression.isString()) 292 return throwError(exec, createError(exec, "String argument expected.")); 288 JSValue JSInjectedScriptHost::evaluate(ExecState* exec) const 289 { 293 290 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 294 JSFunction* evalFunction = globalObject->evalFunction(); 295 CallData callData; 296 CallType callType = evalFunction->methodTable()->getCallData(evalFunction, callData); 297 if (callType == CallTypeNone) 298 return jsUndefined(); 299 MarkedArgumentBuffer args; 300 args.append(expression); 301 302 bool wasEvalEnabled = globalObject->evalEnabled(); 303 globalObject->setEvalEnabled(true); 304 JSValue result = JSC::call(exec, evalFunction, callType, callData, exec->globalThisValue(), args); 305 globalObject->setEvalEnabled(wasEvalEnabled); 306 307 return result; 291 return globalObject->evalFunction(); 308 292 } 309 293 -
trunk/Source/WebCore/inspector/InjectedScriptHost.h
r144950 r146840 105 105 void getEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray); 106 106 107 // FIXME: Remove evaluateReturnsEvalFunction once InjectedScriptHost returns eval in evaluate on V8. https://webkit.org/b/113134 108 #if USE(JSC) 109 bool evaluateReturnsEvalFunction() { return true; } 110 #else 111 bool evaluateReturnsEvalFunction() { return false; } 112 #endif 113 107 114 void clearConsoleMessages(); 108 115 void copyText(const String& text); -
trunk/Source/WebCore/inspector/InjectedScriptHost.idl
r144950 r146840 47 47 [Custom] Array getEventListeners(in Node node); 48 48 49 // FIXME: Remove evaluateReturnsEvalFunction once InjectedScriptHost returns eval in evaluate on V8. https://webkit.org/b/113134 50 readonly attribute boolean evaluateReturnsEvalFunction; 51 52 #if defined(V8_BINDING) && V8_BINDING 53 [Custom] any evaluate(in DOMString text); 54 #else 55 [Custom] readonly attribute any evaluate; 56 #endif 57 49 58 [Custom] DOMString databaseId(in any database); 50 59 [Custom] DOMString storageId(in any storage); 51 [Custom] any evaluate(in DOMString text); 60 52 61 // Only declarative scope (local, with and catch) is accepted. Returns undefined. 53 62 [Custom] any setFunctionVariableValue(in any functionObject, in int scopeIndex, in DOMString variableName, any newValue); -
trunk/Source/WebCore/inspector/InjectedScriptSource.js
r146757 r146840 551 551 _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI) 552 552 { 553 if (InjectedScriptHost.evaluateReturnsEvalFunction) { 554 // We can only use this approach if the evaluate function is the true 'eval'. That allows us to use it with 555 // the 'eval' identifier when calling it. Using 'eval' grants access to the local scope of the closure we 556 // create that provides the command line APIs. 557 558 var thisObject = isEvalOnCallFrame ? object : null; 559 var parameters = [InjectedScriptHost.evaluate, expression]; 560 561 if (injectCommandLineAPI) { 562 // To avoid using a 'with' statement (which fails in strict mode and requires injecting the API object) 563 // we instead create a closure where we evaluate the expression. The command line APIs are passed as 564 // parameters to the closure so they are in scope but not injected. This allows the code evaluated in 565 // the console to stay in strict mode (if is was already set), or to get strict mode by prefixing 566 // expressions with 'use strict';. 567 568 var commandLineAPI = new CommandLineAPI(this._commandLineAPIImpl, thisObject); 569 var parameterNames = Object.getOwnPropertyNames(commandLineAPI); 570 571 for (var i = 0; i < parameterNames.length; ++i) 572 parameters.push(commandLineAPI[parameterNames[i]]); 573 574 var expressionFunctionString = "(function(eval, __currentExpression, " + parameterNames.join(", ") + ") { return eval(__currentExpression); })"; 575 } else { 576 // Use a closure in this case too to keep the same behavior of 'var' being captured by the closure instead 577 // of leaking out into the calling scope. 578 579 var expressionFunctionString = "(function(eval, __currentExpression) { return eval(__currentExpression); })"; 580 } 581 582 var expressionFunction = evalFunction.call(thisObject, expressionFunctionString); 583 var result = expressionFunction.apply(thisObject, parameters); 584 585 if (objectGroup === "console") 586 this._lastResult = result; 587 588 return result; 589 } 590 591 // FIXME: This code path should be removed once V8 also returns 'eval' as the evaluate function. See: https://webkit.org/b/113134 592 553 593 // Only install command line api object for the time of evaluation. 554 594 // Surround the expression in with statements to inject our command line API so that
Note: See TracChangeset
for help on using the changeset viewer.