Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CSS parse error reporting

Josh Matthews edited this pageSep 17, 2015 ·2 revisions

Expose CSS parse errors to developer tools

Background information: Firefox supportsremote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by exposing CSS parsing errors.

Initial steps:

  • compile Servo and ensure that it runs ontests/html/about-mozilla.html
  • email themozilla.dev.servo mailing list introducing your group and your progress
  • find an interesting site that doesn't crash Servo andattach the developer tools
  • define a new trait calledParseErrorReporter incomponents/style_traits/lib.rs with an appropriate method to report an error, and add aerror_reporter member toParserContext that uses this
  • makelog_css_error incomponents/style/parser.rs take a&ParserContext argument and call this method
  • extract the existing code fromlog_css_err into a new type that implementsParseErrorReporter incomponents/layout/layout_task.rs and pass instances of that type to any code that ends up creating aParserContext value
  • at this point, Servo should compile and execute almost exactly as before, but whereRUST_LOG=style used to expose CSS errors, nowRUST_LOG=layout::layout_task will be required instead.

Subsequent steps:

  • Add aPipelineId (fromcomponents/msg/constellation_msg.rs) member toParserContext, to represent the source of parse errors that occur
  • Define a new message type inConstellationControlMsg which contains all of the information necessary to report a CSS error (including the pipeline ID), and make this new error reporter communicate with the script thread by sending messages over aSender<ConstellationControlMsg> value that can be obtained from the code inlayout_task.rs.
  • Process the new message type incomponents/script/script_task.rs by:
    • caching each reported parse error in a vector inDocument (components/script/dom/document.rs)
    • checking thedevtools_wants_updates flag and sending it to the devtools server if it exists (seenotify_devtools for a model inscript_task.rs)
  • Retrieve any cached parse errors for a document on request inhandle_get_cached_messages incomponents/scripts/devtools.rs

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp