Test for Bug 27514 - add support for watched expression.

To begin test, open web inspector, go the scripts panel (enabling script debugging if necccessary), and then click this link: [begin test].

Perform the following steps, and note the expected results:

  1. After clicking the link above, you should now be paused in the body of the test method, thanks to the debugger statement.

  2. Add the following expressions to the "Watch Expressions" section of the Scripts panel sidebar pane: "this", "a", "b", "c" and "d". Do NOT enter the quotes.

  3. The values of the expressions as shown in the window should a DOMWindow for this, undefined for the a, b, and c variables, and a value of ReferenceError: Can't find variable: d for the d variable.

  4. Note that the value for d should not change for the life of the test, as the variable d is never introduced in the program.

  5. Step through the code, and you'll see the values of a, b, and c change, as the variables are assigned. Also note that as the scope changes due to the function invocation, values will be changed to refer to their current scope. The this expression will change when the method is invoked on the object constructed by the test.

  6. Click different stack frames in the Call Stack section to ensure the expressions change value appropriately as the current stack frame changes.

  7. Drive the debugger through the end of the outermost function, so that the debugger is no longer in paused state. The values of a, b, and c should all be a ReferenceError like d, since these variables are defined in the runTest() function, and the expressions are being evaluated against the global object.

  8. From the console, execute the statement "a = 1". The watch expressions do not currently refresh, so the value for a should still be ReferenceError.

  9. Click the "Refresh" button in the Watch Expressions section and the value for "a" should now be "1".

  10. Close down the browser, start it back up, traverse to a web site, bring up web inspector, go to the Scripts panel. You should see the same set of Watch Expressions in the list as you had when you last used web inspector.

  11. Delete an expression by moving the mouse into the Watch Expression section, and clicking the X icon which appears to the right of an expression (on hover).

  12. Delete an expression by double-clicking anywhere on a top-level line of a watch expression, and changing the expression to an empty string or nothing but white-space.

  13. Modify an entry by double-clicking anywhere on a top-level line of a watch expression, and changing the expression.

  14. Enter a new expression, "new Date()". The value should be a toString() version of the date. Repeatedly press the Refresh button to see the value updated with the current time.