Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Editor unresponsive when clicked on commented CSS while live preview is active #9002

Closed

Description

@liaujianjie

In release 43 (OSX Mavericks), the editor becomes unresponsive when you click on a multi-line comment (that comments out a valid class/id) in CSS while having the live preview running. I tried replicating the bug without plugins and it still occurs.

Activity

  1. added this to the milestone on Sep 7, 2014
  2. self-assigned this
    on Sep 7, 2014
  3. Mark-Simulacrum commented on Sep 7, 2014

    @Mark-Simulacrum
    Contributor

    @RaymondLim Cannot reproduce unresponsiveness on 64bit Ubuntu 14.04. (on master ece9bbf).

    I do see a 'Unable to load live preview page' dialog; but this happens after the index.html of the Getting Started project has rendered, although the Brackets' console says this (full stack trace below), but I'm not sure what this means - other than that would probably be the file that Brackets' errors on.

    GET http://127.0.0.1:9222/json  Inspector.js:266
        getDebuggableWindows Inspector.js:266
        connectToURL Inspector.js:348
        _openInterstitialPage LiveDevelopment.js:1125
        _doLaunchAfterServerReady LiveDevelopment.js:1242
        (anonymous function) LiveDevelopment.js:1343
        j jquery-2.1.0.min.js:2
        k.fireWith jquery-2.1.0.min.js:2
        e.(anonymous function) jquery-2.1.0.min.js:2
        (anonymous function) jquery-2.1.0.min.js:2
        j jquery-2.1.0.min.js:2
        k.fireWith jquery-2.1.0.min.js:2
        e.(anonymous function) jquery-2.1.0.min.js:2
        onSuccess StaticServer.js:124
        (anonymous function) StaticServer.js:149
        j jquery-2.1.0.min.js:2
        k.fireWith jquery-2.1.0.min.js:2
        NodeConnection._receive
    
  4. marcelgerber commented on Sep 7, 2014

    @marcelgerber
    Contributor

    @Mark-Simulacrum That's a rather common error message, which is probably not part of the issue.
    Apparently nobody knows what it means :D See #8611.

  5. marcelgerber commented on Sep 7, 2014

    @marcelgerber
    Contributor

    @Mark-Simulacrum I found a more reproducible recipe that works for me on Win. Could you try it?

    1. Create the two files i.html and i.css, with the contents:
    <html>
        <head>
            <link rel="stylesheet" href="i.css" type="text/css">
        </head>
        <body>
            Some text.
        </body>
    </html>
    /* body {
        background-color: black;
        color: white;
    } */
    1. Start live preview on i.html and wait
    2. Switch to i.css
    3. Remove */ on line 4, then press Backspace again

    Result: The editor becomes unresponsive

  6. marcelgerber commented on Sep 7, 2014

    @marcelgerber
    Contributor

    git bisect points to @RaymondLim's c954fb4.

  7. Mark-Simulacrum commented on Sep 7, 2014

    @Mark-Simulacrum
    Contributor

    @marcelgerber Yes, your test case does allow me to reproduce the hang. Will test the PR branch soon.

  8. self-assigned this
    on Sep 17, 2014
  9. 1 remaining item

  10. peterflynn commented on Sep 25, 2014

    @peterflynn
    Member

    @Mark-Simulacrum @marcelgerber Since you both repro'ed this earlier, would one of you mind confirming the fix before we close it? (I tested it a bit during PR review, but this was a nasty enough bug that it never hurts to get some extra eyes on it). Thanks!

  11. marcelgerber commented on Sep 25, 2014

    @marcelgerber
    Contributor

    @peterflynn @RaymondLim I'm sorry to say, but using the files from above recipe, the bug got even worse.
    Latest master (03ab969) on Win 8.1


    1. Create the two files i.html and i.css, with the contents:
    <html>
        <head>
            <link rel="stylesheet" href="i.css" type="text/css">
        </head>
        <body>
            Some text.
        </body>
    </html>
    /* body {
        background-color: black;
        color: white;
    } */
    1. Start live preview on i.html and wait
    2. Switch to i.css
    3. Click after */

    Result: The editor becomes unresponsive

  12. peterflynn commented on Sep 25, 2014

    @peterflynn
    Member

    Ugh, sorry -- my fault. My last suggestion for simplifying the loop was not quite right. The stopping condition needs to exactly match how TokenUtils decides whether to stop & return false or not.

    @RaymondLim thee potential ways to fix that:

    1. Just change the loop to match movePrevToken() properly -- i.e. while (!(ctx.pos.line <= 0 && (ctx.pos.ch <= 0 || ctx.token.start <= 0)))
    2. Same, but wrap that up in a TokenUtils.isAtStart() utility for clarity
    3. Change movePrevToken() to more consistently stop at the start of the stream, instead of stopping one token sooner when it knows that's the last token available. (This seems more maintainable in the long run, but a tad riskier because it would affect other callers... albeit callers that are probably well unit-tested).
  13. peterflynn commented on Sep 25, 2014

    @peterflynn
    Member

    @RaymondLim I can post a fix using approach 2 above -- just proofed it out.

  14. marcelgerber commented on Sep 29, 2014

    @marcelgerber
    Contributor

    Looks good now.

  15. JeffryBooher commented on Sep 29, 2014

    @JeffryBooher
    Contributor

    Closing as fixed. @liaujianjie let us know if you still see problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions