Changeset 255675 in webkit
- Timestamp:
- Feb 4, 2020 7:59:42 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r255674 r255675 1 2020-02-04 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: REGRESSION(r248287): Console: function objects saved to a $n will be invoked instead of just referenced when evaluating in the Console 4 https://bugs.webkit.org/show_bug.cgi?id=207180 5 <rdar://problem/58860268> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/runtime/saveResult.html: 10 * inspector/runtime/saveResult-expected.txt: 11 1 12 2020-02-04 Jacob Uphoff <jacob_uphoff@apple.com> 2 13 -
trunk/LayoutTests/inspector/runtime/saveResult-expected.txt
r189415 r255675 35 35 PASS: Evaluated result 999 should match previous value $1. 36 36 37 -- Running test case: SaveFunctionValue 38 PASS: Function should become $3. 39 PASS: Saved value should match previous value $3. 40 PASS: Evaluated function should match previous value $3. 41 PASS: Calling saved function should become $4. 42 PASS: Calling saved function should return expected value. 43 -
trunk/LayoutTests/inspector/runtime/saveResult.html
r236766 r255675 172 172 }); 173 173 174 // ------ 175 176 suite.addTestCase({ 177 name: "SaveFunctionValue", 178 description: "Ensure that saving a function object doesn't evaluate the function object when fetching it via a $n getter.", 179 async test() { 180 const functionName = "testSaveFunctionValue"; 181 const functionReturn = "testSaveFunctionValue Return Value"; 182 183 let createFunctionEvaluateResult = await RuntimeAgent.evaluate.invoke({expression: `function ${functionName}() { return "${functionReturn}"; } ${functionName}`, objectGroup: "test", includeCommandLineAPI: true, saveResult: true}); 184 InspectorTest.assert(!createFunctionEvaluateResult.error, "Should not be a protocol error."); 185 InspectorTest.expectEqual(createFunctionEvaluateResult.savedResultIndex, 3, "Function should become $3."); 186 187 let getSavedValueEvaluateResult = await RuntimeAgent.evaluate.invoke({expression: `$3`, objectGroup: "test", includeCommandLineAPI: true, saveResult: true}); 188 InspectorTest.assert(!getSavedValueEvaluateResult.error, "Should not be a protocol error."); 189 InspectorTest.expectEqual(getSavedValueEvaluateResult.savedResultIndex, 3, "Saved value should match previous value $3."); 190 InspectorTest.expectEqual(createFunctionEvaluateResult.result.description, getSavedValueEvaluateResult.result.description, "Evaluated function should match previous value $3."); 191 192 let callFunctionEvaluateResult = await RuntimeAgent.evaluate.invoke({expression: functionName + "()", objectGroup: "test", includeCommandLineAPI: true, saveResult: true}); 193 InspectorTest.assert(!callFunctionEvaluateResult.error, "Should not be a protocol error."); 194 InspectorTest.expectEqual(callFunctionEvaluateResult.savedResultIndex, 4, "Calling saved function should become $4."); 195 InspectorTest.expectEqual(callFunctionEvaluateResult.result.value, functionReturn, "Calling saved function should return expected value."); 196 } 197 }); 198 174 199 suite.runTestCasesAndFinish(); 175 200 } -
trunk/Source/JavaScriptCore/ChangeLog
r255659 r255675 1 2020-02-04 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: REGRESSION(r248287): Console: function objects saved to a $n will be invoked instead of just referenced when evaluating in the Console 4 https://bugs.webkit.org/show_bug.cgi?id=207180 5 <rdar://problem/58860268> 6 7 Reviewed by Joseph Pecoraro. 8 9 * inspector/InjectedScriptSource.js: 10 (CommandLineAPI): 11 Instead of deciding whether to wrap the value given for a `$n` getter based on if the value 12 is already a function, always wrap getter values in a function so that if the value being 13 stored in the getter is already a function, it isn't used as the callback for the getter and 14 therefore invoked when the getter is referenced. 15 1 16 2020-02-03 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js
r252202 r255675 1467 1467 let savedResultAlias = InjectedScriptHost.savedResultAlias; 1468 1468 1469 let defineGetter = (key, value ) => {1470 if ( typeof value !== "function") {1469 let defineGetter = (key, value, wrap) => { 1470 if (wrap) { 1471 1471 let originalValue = value; 1472 1472 value = function() { return originalValue; }; … … 1479 1479 1480 1480 if ("_lastResult" in injectedScript) 1481 defineGetter("_", injectedScript._lastResult );1481 defineGetter("_", injectedScript._lastResult, true); 1482 1482 1483 1483 if ("_exceptionValue" in injectedScript) 1484 defineGetter("exception", injectedScript._exceptionValue );1484 defineGetter("exception", injectedScript._exceptionValue, true); 1485 1485 1486 1486 if ("_eventValue" in injectedScript) 1487 defineGetter("event", injectedScript._eventValue );1487 defineGetter("event", injectedScript._eventValue, true); 1488 1488 1489 1489 // $1-$99 1490 1490 for (let i = 1; i < injectedScript._savedResults.length; ++i) 1491 defineGetter(i, injectedScript._savedResults[i] );1491 defineGetter(i, injectedScript._savedResults[i], true); 1492 1492 1493 1493 for (let name in CommandLineAPI.getters)
Note: See TracChangeset
for help on using the changeset viewer.