Changeset 126168 in webkit
- Timestamp:
- Aug 21, 2012 10:03:12 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126165 r126168 1 2012-08-21 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: do not use window's eval in InjectedScript 4 https://bugs.webkit.org/show_bug.cgi?id=94610 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/console/console-eval-fake-expected.txt: Added. 9 * inspector/console/console-eval-fake.html: Added. 10 1 11 2012-08-21 Adam Barth <abarth@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r126165 r126168 1 2012-08-21 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: do not use window's eval in InjectedScript 4 https://bugs.webkit.org/show_bug.cgi?id=94610 5 6 Reviewed by Yury Semikhatsky. 7 8 Otherwise, inspector does not work when eval is overriden. 9 10 Test: inspector/console/console-eval-fake.html 11 12 * bindings/js/JSInjectedScriptHostCustom.cpp: 13 (WebCore::JSInjectedScriptHost::evaluate): 14 (WebCore): 15 * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: 16 (WebCore::V8InjectedScriptHost::evaluateCallback): 17 (WebCore): 18 * inspector/InjectedScriptHost.idl: 19 * inspector/InjectedScriptSource.js: 20 (.): 21 1 22 2012-08-21 Adam Barth <abarth@webkit.org> 2 23 -
trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp
r125654 r126168 276 276 } 277 277 278 JSValue JSInjectedScriptHost::evaluate(ExecState* exec) 279 { 280 JSValue expression = exec->argument(0); 281 if (!expression.isString()) 282 return throwError(exec, createError(exec, "String argument expected.")); 283 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 284 JSFunction* evalFunction = globalObject->evalFunction(); 285 CallData callData; 286 CallType callType = evalFunction->methodTable()->getCallData(evalFunction, callData); 287 if (callType == CallTypeNone) 288 return jsUndefined(); 289 MarkedArgumentBuffer args; 290 args.append(expression); 291 292 bool wasEvalEnabled = globalObject->evalEnabled(); 293 globalObject->setEvalEnabled(true); 294 JSValue result = JSC::call(exec, evalFunction, callType, callData, exec->globalThisValue(), args); 295 globalObject->setEvalEnabled(wasEvalEnabled); 296 297 return result; 298 } 299 278 300 } // namespace WebCore 279 301 -
trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
r125654 r126168 300 300 } 301 301 302 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateCallback(const v8::Arguments& args) 303 { 304 INC_STATS("InjectedScriptHost.evaluate()"); 305 if (args.Length() < 1) 306 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argument expected."))); 307 308 v8::Handle<v8::String> expression = args[0]->ToString(); 309 if (expression.IsEmpty()) 310 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argument must be a string."))); 311 312 v8::Handle<v8::Script> script = v8::Script::Compile(expression); 313 if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it. 314 return v8::Handle<v8::Value>(); 315 return script->Run(); 316 } 317 302 318 } // namespace WebCore 303 319 -
trunk/Source/WebCore/inspector/InjectedScriptHost.idl
r123223 r126168 48 48 [Custom] DOMString databaseId(in DOMObject database); 49 49 [Custom] DOMString storageId(in DOMObject storage); 50 [Custom] DOMObject evaluate(in DOMString text); 50 51 }; 51 52 } -
trunk/Source/WebCore/inspector/InjectedScriptSource.js
r125186 r126168 175 175 _parseObjectId: function(objectId) 176 176 { 177 return eval("(" + objectId + ")");177 return InjectedScriptHost.evaluate("(" + objectId + ")"); 178 178 }, 179 179 … … 198 198 dispatch: function(methodName, args) 199 199 { 200 var argsArray = eval("(" + args + ")");200 var argsArray = InjectedScriptHost.evaluate("(" + args + ")"); 201 201 var result = this[methodName].apply(this, argsArray); 202 202 if (typeof result === "undefined") { … … 343 343 evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue) 344 344 { 345 return this._evaluateAndWrap( inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI, returnByValue);345 return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue); 346 346 }, 347 347 … … 361 361 if (args) { 362 362 var resolvedArgs = []; 363 args = eval(args);363 args = InjectedScriptHost.evaluate(args); 364 364 for (var i = 0; i < args.length; ++i) { 365 365 objectId = args[i].objectId; … … 383 383 try { 384 384 var objectGroup = this._idToObjectGroupName[parsedObjectId.id]; 385 var func = eval("(" + expression + ")");385 var func = InjectedScriptHost.evaluate("(" + expression + ")"); 386 386 if (typeof func !== "function") 387 387 return "Given expression does not evaluate to a function"; … … 516 516 _callFrameForId: function(topCallFrame, callFrameId) 517 517 { 518 var parsedCallFrameId = eval("(" + callFrameId + ")");518 var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")"); 519 519 var ordinal = parsedCallFrameId["ordinal"]; 520 520 var callFrame = topCallFrame; … … 563 563 { 564 564 delete this._modules[name]; 565 var module = eval("(" + source + ")");565 var module = InjectedScriptHost.evaluate("(" + source + ")"); 566 566 this._modules[name] = module; 567 567 return module;
Note: See TracChangeset
for help on using the changeset viewer.