Bug 138845

Summary: Web Inspector: Improve basic JavaScript completion in inline <script>s
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2014-11-18 14:15:07 PST
* SUMMARY
Basic JavaScript completion does not work in editable inline <script>s. There is an uncaught exception:

    CONSOLE ERROR TypeError: undefined is not an object (evaluating 'mainToken.state.lexical.type')

It looks like we should be using mainToken.state.localState when inside a JavaScript mode inside of an HTML mode.

* TEST
1. <script>
2. (function() {
3.     var object = {};
4.     
6. })()
7. </script>

* STEPS TO REPRODUCE
1. Inspect the test page
2. Start editing on line 4
3. Type "un"
  => expected "undefined" to come up as a completion suggestion
4. Type "obj"
  => expected local variable "object" to come up as a completion suggestion
5. Type "i"
  => expected built-in suggestions like "if", "in", and "instanceof"

* NOTES
- Should not regress editing inside JavaScript resources.
Comment 1 Radar WebKit Bug Importer 2014-11-18 14:15:39 PST
<rdar://problem/19020769>
Comment 2 Joseph Pecoraro 2014-11-18 14:17:02 PST
Created attachment 241811 [details]
[PATCH] Proposed Fix
Comment 3 Timothy Hatcher 2014-11-19 09:51:42 PST
Comment on attachment 241811 [details]
[PATCH] Proposed Fix

Nice!
Comment 4 WebKit Commit Bot 2014-11-19 10:32:21 PST
Comment on attachment 241811 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 241811

Committed r176324: <http://trac.webkit.org/changeset/176324>
Comment 5 WebKit Commit Bot 2014-11-19 10:32:24 PST
All reviewed patches have been landed.  Closing bug.