Bug 138845 - Web Inspector: Improve basic JavaScript completion in inline <script>s
Summary: Web Inspector: Improve basic JavaScript completion in inline <script>s
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-11-18 14:15 PST by Joseph Pecoraro
Modified: 2014-11-19 10:32 PST (History)
5 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (3.46 KB, patch)
2014-11-18 14:17 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.