Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-2650

[weinre] Weinre style inspection breaks with normalize.css

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: weinre
    • Labels:
    • Environment:

      Mac OS 10.8.2

      Description

      The following lines in normalize.css cause weinre to throw the below error causing the ability to inspect client styles to fail.

      https://github.com/appleboy/normalize.scss/blob/master/normalize.css

      /*

      • Remove inner padding and search cancel button in Safari 5 and Chrome
      • on OS X.
        */

      input[type="search"]::-webkit-search-cancel-button,
      input[type="search"]::-webkit-search-decoration

      { -webkit-appearance: none; }

      Weinre server error:
      2013-03-11T23:18:19.932Z weinre: target t-113: weinre: invocation exception on WiCSSImpl.getStylesForNode(): Error: SyntaxError: DOM Exception 12

      Result: client style inspection fails.

      Version: 2.0.0-pre-HA5N9T49

        Issue Links

          Activity

          Hide
          pmuellr Patrick Mueller added a comment -

          Interesting. Apparently matchesSelector doesn't throw too many errors, otherwise we would have seen this more often.

          Here's a test case:

          <script src="http://localhost:8081/target/target-script.js#anonymous"></script>
          
          <style>
          input[type="search"]::-webkit-search-cancel-button,
          input[type="search"]::-webkit-search-decoration {
              -webkit-appearance: none;
          }
          </style>
          
          <input type="search">
          

          When the following selector is passed to _webkitMatchesSelector (aka matchesSelector):

          "input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration"
          

          an exception will be thrown with the following stack:

          "Error: An invalid or illegal string was specified.
              at _webkitMatchesSelector (weinre/target/CSSStore.amd.js:354:18)
              at CSSStore.module.exports.CSSStore.getMatchedCSSRules (weinre/target/CSSStore.amd.js:54:14)
              at WiCSSImpl.module.exports.WiCSSImpl.getStylesForNode (weinre/target/WiCSSImpl.amd.js:33:40)
              at MessageDispatcher.module.exports.MessageDispatcher._handleMessage (weinre/common/MessageDispatcher.amd.js:183:14)
              at eval (weinre/common/Binding.amd.js:19:21)
              at EventListeners.module.exports.EventListeners.fire (weinre/common/EventListeners.amd.js:43:20)
              at WebSocketXhr.module.exports.WebSocketXhr._fireEventListeners (weinre/common/WebSocketXhr.amd.js:190:37)
              at WebSocketXhr.module.exports.WebSocketXhr._handleXhrResponseGet (weinre/common/WebSocketXhr.amd.js:118:26)
              at XMLHttpRequest._xhrEventHandler (weinre/common/WebSocketXhr.amd.js:243:32)"
          

          We should be catching this exception and soldiering on. If it's not a valid selector, it can't possibly match, right???

          Show
          pmuellr Patrick Mueller added a comment - Interesting. Apparently matchesSelector doesn't throw too many errors, otherwise we would have seen this more often. Here's a test case: <script src="http://localhost:8081/target/target-script.js#anonymous"></script> <style> input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } </style> <input type="search"> When the following selector is passed to _webkitMatchesSelector (aka matchesSelector): "input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration" an exception will be thrown with the following stack: "Error: An invalid or illegal string was specified. at _webkitMatchesSelector (weinre/target/CSSStore.amd.js:354:18) at CSSStore.module.exports.CSSStore.getMatchedCSSRules (weinre/target/CSSStore.amd.js:54:14) at WiCSSImpl.module.exports.WiCSSImpl.getStylesForNode (weinre/target/WiCSSImpl.amd.js:33:40) at MessageDispatcher.module.exports.MessageDispatcher._handleMessage (weinre/common/MessageDispatcher.amd.js:183:14) at eval (weinre/common/Binding.amd.js:19:21) at EventListeners.module.exports.EventListeners.fire (weinre/common/EventListeners.amd.js:43:20) at WebSocketXhr.module.exports.WebSocketXhr._fireEventListeners (weinre/common/WebSocketXhr.amd.js:190:37) at WebSocketXhr.module.exports.WebSocketXhr._handleXhrResponseGet (weinre/common/WebSocketXhr.amd.js:118:26) at XMLHttpRequest._xhrEventHandler (weinre/common/WebSocketXhr.amd.js:243:32)" We should be catching this exception and soldiering on. If it's not a valid selector, it can't possibly match, right???
          Hide
          pmuellr Patrick Mueller added a comment -

          Also wanted to make sure you understand that - apparently - the selector you've specified isn't valid. Kinda weird that we obtained the value somehow via introspection, turned around and used it in another API, and that one threw an error.

          I suppose it would be nice for weinre to somehow let you know that that particular selector is invalid, not quite sure how we'd do that though. Console message?

          Show
          pmuellr Patrick Mueller added a comment - Also wanted to make sure you understand that - apparently - the selector you've specified isn't valid. Kinda weird that we obtained the value somehow via introspection, turned around and used it in another API, and that one threw an error. I suppose it would be nice for weinre to somehow let you know that that particular selector is invalid, not quite sure how we'd do that though. Console message?
          Show
          pmuellr Patrick Mueller added a comment - fixed in commit https://git-wip-us.apache.org/repos/asf?p=cordova-weinre.git;a=commit;h=bb83d05ba862b045917a42a6e5a4554383285155

            People

            • Assignee:
              pmuellr Patrick Mueller
              Reporter:
              jfroom Jeff Froom
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development