Changeset 106657 in webkit
- Timestamp:
- Feb 3, 2012 6:47:31 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106654 r106657 1 2012-01-27 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: console evaluation doesn't work on breakpoint in pages with CSP 4 https://bugs.webkit.org/show_bug.cgi?id=77203 5 6 Inspector console evaluation now works when debugger is paused in a page with 7 content-security-policy prohibiting evals. 8 9 Reviewed by Pavel Feldman. 10 11 * inspector/debugger/eval-on-pause-blocked-expected.txt: Added. 12 * inspector/debugger/eval-on-pause-blocked.html: Added. 13 1 14 2012-02-03 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r106655 r106657 1 2012-01-27 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: console evaluation doesn't work on breakpoint in pages with CSP 4 https://bugs.webkit.org/show_bug.cgi?id=77203 5 6 Inspector console evaluation now works when debugger is paused in a page with 7 content-security-policy prohibiting evals. 8 9 Reviewed by Pavel Feldman. 10 11 Test: inspector/debugger/eval-on-pause-blocked.html 12 13 * bindings/js/JSInjectedScriptHostCustom.cpp: 14 * bindings/js/ScriptState.cpp: 15 (WebCore::evalEnabled): 16 (WebCore): 17 (WebCore::setEvalEnabled): 18 * bindings/js/ScriptState.h: 19 (WebCore): 20 * bindings/v8/ScriptObject.h: 21 (WebCore::ScriptObject::ScriptObject): 22 * bindings/v8/ScriptState.cpp: 23 (WebCore::evalEnabled): 24 (WebCore): 25 (WebCore::setEvalEnabled): 26 * bindings/v8/ScriptState.h: 27 (WebCore): 28 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 29 * inspector/InjectedScript.cpp: 30 (WebCore::InjectedScript::makeCall): 31 * inspector/InjectedScriptHost.idl: 32 * inspector/InjectedScriptSource.js: 33 (.): 34 1 35 2012-02-03 Rob Buis <rbuis@rim.com> 2 36 -
trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r106101 r106657 77 77 } 78 78 79 JSValue JSInjectedScriptHost::evaluate(ExecState* exec)80 {81 JSValue expression = exec->argument(0);82 if (!expression.isString())83 return throwError(exec, createError(exec, "String argument expected."));84 JSGlobalObject* globalObject = exec->lexicalGlobalObject();85 JSFunction* evalFunction = globalObject->evalFunction();86 CallData callData;87 CallType callType = evalFunction->methodTable()->getCallData(evalFunction, callData);88 if (callType == CallTypeNone)89 return jsUndefined();90 MarkedArgumentBuffer args;91 args.append(expression);92 93 bool wasEvalEnabled = globalObject->evalEnabled();94 globalObject->setEvalEnabled(true);95 JSValue result = JSC::call(exec, evalFunction, callType, callData, exec->globalThisValue(), args);96 globalObject->setEvalEnabled(wasEvalEnabled);97 98 return result;99 }100 101 79 JSValue JSInjectedScriptHost::inspectedNode(ExecState* exec) 102 80 { -
trunk/Source/WebCore/bindings/js/ScriptState.cpp
r96465 r106657 72 72 } 73 73 74 bool evalEnabled(ScriptState* scriptState) 75 { 76 JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); 77 return globalObject->evalEnabled(); 78 } 79 80 void setEvalEnabled(ScriptState* scriptState, bool enabled) 81 { 82 JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); 83 return globalObject->setEvalEnabled(enabled); 84 } 85 74 86 ScriptState* mainWorldScriptState(Frame* frame) 75 87 { -
trunk/Source/WebCore/bindings/js/ScriptState.h
r95901 r106657 67 67 DOMWindow* domWindowFromScriptState(ScriptState*); 68 68 69 bool evalEnabled(ScriptState*); 70 void setEvalEnabled(ScriptState*, bool); 71 69 72 ScriptState* mainWorldScriptState(Frame*); 70 73 -
trunk/Source/WebCore/bindings/v8/ScriptObject.h
r95901 r106657 44 44 public: 45 45 ScriptObject(ScriptState*, v8::Handle<v8::Object>); 46 ScriptObject() {};46 ScriptObject() : m_scriptState(0) { }; 47 47 virtual ~ScriptObject() {} 48 48 -
trunk/Source/WebCore/bindings/v8/ScriptState.cpp
r97258 r106657 110 110 } 111 111 112 bool evalEnabled(ScriptState* scriptState) 113 { 114 v8::HandleScope handleScope; 115 return scriptState->context()->IsCodeGenerationFromStringsAllowed(); 116 } 117 118 void setEvalEnabled(ScriptState* scriptState, bool enabled) 119 { 120 v8::HandleScope handleScope; 121 return scriptState->context()->AllowCodeGenerationFromStrings(enabled); 122 } 123 112 124 ScriptState* mainWorldScriptState(Frame* frame) 113 125 { -
trunk/Source/WebCore/bindings/v8/ScriptState.h
r95901 r106657 110 110 DOMWindow* domWindowFromScriptState(ScriptState*); 111 111 112 bool evalEnabled(ScriptState*); 113 void setEvalEnabled(ScriptState*, bool); 114 112 115 ScriptState* mainWorldScriptState(Frame*); 113 116 -
trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r106101 r106657 67 67 } 68 68 69 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateCallback(const v8::Arguments& args)70 {71 INC_STATS("InjectedScriptHost.evaluate()");72 if (args.Length() < 1)73 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argument expected.")));74 75 v8::Handle<v8::String> expression = args[0]->ToString();76 if (expression.IsEmpty())77 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argument must be a string.")));78 79 v8::Handle<v8::Script> script = v8::Script::Compile(expression);80 if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it.81 return v8::Handle<v8::Value>();82 return script->Run();83 }84 85 69 v8::Handle<v8::Value> V8InjectedScriptHost::inspectedNodeCallback(const v8::Arguments& args) 86 70 { -
trunk/Source/WebCore/inspector/InjectedScript.cpp
r106101 r106657 209 209 InspectorInstrumentationCookie cookie = domWindow && domWindow->frame() ? InspectorInstrumentation::willCallFunction(domWindow->frame()->page(), "InjectedScript", 1) : InspectorInstrumentationCookie(); 210 210 bool hadException = false; 211 212 ScriptState* scriptState = m_injectedScriptObject.scriptState(); 213 bool evalIsDisabled = false; 214 if (scriptState) { 215 evalIsDisabled = !evalEnabled(scriptState); 216 // Temporarily enable allow evals for inspector. 217 if (evalIsDisabled) 218 setEvalEnabled(scriptState, true); 219 } 220 211 221 ScriptValue resultValue = function.call(hadException); 222 223 if (evalIsDisabled) 224 setEvalEnabled(scriptState, false); 225 212 226 InspectorInstrumentation::didCallFunction(cookie); 213 227 -
trunk/Source/WebCore/inspector/InjectedScriptHost.idl
r106101 r106657 37 37 void clearConsoleMessages(); 38 38 39 [Custom] DOMObject evaluate(in DOMString text);40 41 39 void copyText(in DOMString text); 42 40 [Custom] void inspect(in DOMObject objectId, in DOMObject hints); -
trunk/Source/WebCore/inspector/InjectedScriptSource.js
r106101 r106657 142 142 _parseObjectId: function(objectId) 143 143 { 144 return InjectedScriptHost.evaluate("(" + objectId + ")");144 return eval("(" + objectId + ")"); 145 145 }, 146 146 … … 157 157 dispatch: function(methodName, args) 158 158 { 159 var argsArray = InjectedScriptHost.evaluate("(" + args + ")");159 var argsArray = eval("(" + args + ")"); 160 160 var result = this[methodName].apply(this, argsArray); 161 161 if (typeof result === "undefined") { … … 260 260 evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue) 261 261 { 262 return this._evaluateAndWrap( InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue);262 return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI, returnByValue); 263 263 }, 264 264 … … 272 272 if (args) { 273 273 var resolvedArgs = []; 274 args = InjectedScriptHost.evaluate(args);274 args = eval(args); 275 275 for (var i = 0; i < args.length; ++i) { 276 276 var objectId = args[i].objectId; … … 294 294 try { 295 295 var objectGroup = this._idToObjectGroupName[parsedObjectId.id]; 296 var func = InjectedScriptHost.evaluate("(" + expression + ")");296 var func = eval("(" + expression + ")"); 297 297 if (typeof func !== "function") 298 298 return "Given expression does not evaluate to a function"; … … 367 367 _callFrameForId: function(topCallFrame, callFrameId) 368 368 { 369 var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")");369 var parsedCallFrameId = eval("(" + callFrameId + ")"); 370 370 var ordinal = parsedCallFrameId.ordinal; 371 371 var callFrame = topCallFrame;
Note: See TracChangeset
for help on using the changeset viewer.