Skip to content

Commit 3f20dda

Browse files
author
Razvan Caliman
committed
WIP: Update Web Inspector docs:
- Added Overview of Web Inspector - Removed WebReplay page - Tweaks to language
1 parent 5f5eef1 commit 3f20dda

File tree

5 files changed

+61
-283
lines changed

5 files changed

+61
-283
lines changed

docs/Deep Dive/Web Inspector/AnIntroduction.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Introduction
22

3-
The Web Inspector allows you to view the page source, live DOM hierarchy, script debugging, profiling and more!
3+
Web Inspector allows you to view the page source, live DOM hierarchy, script debugging, profiling and more!
44

5-
## Enabling the Web Inspector
5+
## Enabling Web Inspector
66

77
### Safari
88

99
* Enable the Develop menu option in the Advanced preferences.
10-
* Use the optional toolbar button, Develop menu or Inspect Element context menu to access the Web Inspector.
10+
* Use the optional toolbar button, Develop menu or Inspect Element context menu to access Web Inspector.
1111

1212
### Other WebKit clients
1313

@@ -18,11 +18,13 @@ The Web Inspector allows you to view the page source, live DOM hierarchy, script
1818
defaults write "bundle-identifier-here" WebKitDeveloperExtras -bool true
1919
```
2020

21-
* Relaunch the application in order to use the Web Inspector
21+
* Relaunch the application in order to use Web Inspector
2222

23-
## Using the Web Inspector
23+
## Using Web Inspector
2424

25-
The Web Inspector can be opened by '''right clicking anywhere on a web page''' and choosing '''Inspect Element'''. Once open, it highlights the node on the page as it is selected in the hierarchy. You can also search for nodes by node name, id and CSS class name.
25+
The most complete resource for Web Inspector is the [Web Inspector Reference](https://webkit.org/web-inspector/), and help links in Web Inspector itself can take you to help specific to the current part of the tools you are using.
26+
27+
Web Inspector can be opened by '''right clicking anywhere on a web page''' and choosing '''Inspect Element'''. Once open, it highlights the node on the page as it is selected in the hierarchy. You can also search for nodes by node name, id and CSS class name.
2628

2729
The Node pane shows the current node type and name, as well as any element attributes.
2830

@@ -32,11 +34,11 @@ The Metrics pane provides a quick visual look at how margins, borders and paddin
3234

3335
Various HTML and JavaScript properties, including length of text nodes, offsetWidth/Height, class names, and parent/sibling information are vieweable in the Properties pane.
3436

35-
See [Safari User Guide for Web Developers](http://developer.apple.com/safari/library/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/UsingtheWebInspector/UsingtheWebInspector.html) for more details on other panels of the Web Inspector.
37+
See [Safari User Guide for Web Developers](http://developer.apple.com/safari/library/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/UsingtheWebInspector/UsingtheWebInspector.html) for more details on other panels of Web Inspector.
3638

37-
## Hacking on the Web Inspector
39+
## Hacking on Web Inspector
3840

39-
Most of the Web Inspector's code is HTML, JavaScript, and CSS—so it's very easy to implement new features and fix bugs!
41+
Most of Web Inspector's code is HTML, JavaScript, and CSS—so it's very easy to implement new features and fix bugs!
4042

4143
[List Web Inspector bugs and feature requests](http://tinyurl.com/2vqypl)
4244

@@ -120,7 +122,7 @@ Most of the Web Inspector's code is HTML, JavaScript, and CSS—so it's very eas
120122
| Edit Breakpoint Condition | Right-Click on line number | Right-Click on line number |
121123

122124

123-
## Using the Web Inspector remotely
125+
## Using Web Inspector remotely
124126

125127
### Remote Web Inspector on GTK+ and EFL ports
126128

docs/Deep Dive/Web Inspector/Contributing.md

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,55 @@
11
# Contributing to Web Inspector
22

3-
## Modifying the Web Inspector
3+
The process for contributing to Web Inspector is the same as for [contributing to WebKit](/Getting%20Started/ContributingCode.html).
44

5-
The Web Inspector user interface is implemented using JavaScript, CSS, and HTML. So, it's relatively easy to dig into the Web Inspector's sources and fix bugs or add new features.
5+
This page provides an overview of Web Inspector and some techniques useful when working on Web Inspector.
66

7-
This wiki page documents the minimal steps required to modify styles used by the Web Inspector and submit your changes as a patch for review.
7+
## Overview of Web Inspector
88

9-
Let's say, we don't like red color for CSS property names, and we would prefer property names to be purple instead. Let's get started!
9+
Web Inspector consists of two main parts:
1010

11-
## Inspect The Inspector
11+
- the frontend, which is the user interface a developer interacts with.
12+
- the backend, which instruments the inspected target, such as a web page.
1213

13-
Since the Web Inspector UI is just another web page, we can inspect the Web Inspector with a second-level Web Inspector instance to quickly see what's going on. This requires a few magic settings to enable the "Inspect..." context menu on the Web Inspector window.
1414

15-
For the Mac port, set the following defaults to allow inspecting the inspector.
15+
### Frontend
16+
The Web Inspector frontend is implemented using JavaScript, CSS, and HTML in files under `Source/WebInspectorUI/`.
1617

17-
```
18-
defaults write NSGlobalDomain WebKitDebugDeveloperExtrasEnabled -bool YES
19-
```
18+
It follows a Model-View-Controller (MVC) approach. Models are representations of the inspectable objects, events, and resources. Views are responsible for laying out the user interface and responding to user interaction. Controllers orchestrate the data flow between models and views.
19+
20+
21+
### Backend
22+
The Web Inspector backend is written primarily in C++. It collects representations of things on the inspected target, like DOM nodes, network requests and responses, scripts, stylehseets, events, etc. It also implements ways to observe, change and block resources, and override behaviors of the inspected target.
23+
24+
The files for the backend are more spread out. Find them under:
25+
26+
- `Source/JavaScriptCore/inspector`
27+
- `Source/WebCore/inspector`
28+
- `Source/WebKit/UIProcess/inspector`
29+
- `Source/WebKit/WebProcess/inspector`.
30+
31+
32+
### Protocol
33+
The frontend and backend communicate via a JSON-based protocol which facilitates the exchange of messages with typed data payloads.
2034

35+
Protocol messages describe commands and events. Commands are invoked by the frontend on the backend, such as requesting a list of resources or updating the contents of a resource. Events are dispatched by the backend to be handled by the frontend, such as the notification that a new resource has been added.
2136

22-
After updating these settings, run the [https://developer.apple.com/safari/technology-preview/ Safari Technology Preview]. Then, open the Web Inspector and right-click to inspect the inspector itself.
37+
The files for the inspector protocol definitions are found under `Source/JavaScriptCore/inspector/protocol`.
2338

24-
By inspecting the CSS property names in the second-level inspector, we quickly find that the colors are defined by rules in `Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css`.
25-
To create and submit a patch with our changes, we must to create an accompanying Bugzilla bug, and compute the diff of our changes against WebKit trunk.
39+
## Inspecting Web Inspector
40+
41+
Since the Web Inspector user interface is a web page, you can inspect it with a second-level Web Inspector instance.
42+
43+
To enable this, open the Settings tab of Web Inspector. Under the Experimental section, enable "Allow Inspecting Web Inspector". This enables the "Inspect Element" context menu item within Web Inspector itself.
44+
45+
You can also observe the exchange of protocol messages between the backend and frontend.
46+
To do this, you must first enable the debug user interface in the second-level Web Inspector.
47+
48+
Press the keyboard shortcut Cmd-Opt-Shift-D to reveal additional buttons in the second-level Web Inspector tab bar. Click the button to dump all inspector message to the console. In the Console tab of the second-level Web Inspector, you can now see a live log of messages exchanged between the backend and frontend of the main Web Inspector.
49+
50+
## Making changes to Web Inspector
51+
52+
TBD
2653

2754
## Create / Update a Bug Report
2855

@@ -33,7 +60,8 @@ The WebKit project uses "bugs" in Bugzilla for fixes, new features, and any othe
3360

3461
So, the first step is to ensure that your proposed enhancement or fix has an associated bug.
3562

36-
Once you find or create a bug report, make sure to add a comment stating your intent to work on the bug.
63+
Once you find or create a bug report, make sure to add a comment stating your intent to work on the bug.
64+
3765
This step is very important; comments on bugs in the Web Inspector Bugzilla component will automatically notify Web Inspector reviewers.
3866

3967
This will allow them to answer any questions you may have about a proposed fix, and give feedback, pointers, and guidance for solving the issue.
@@ -45,7 +73,7 @@ This will allow them to answer any questions you may have about a proposed fix,
4573
```
4674
git clone https://github.com/WebKit/WebKit.git WebKit
4775
cd WebKit
48-
git checkout -b purple_css_values
76+
git checkout -b BRANCH_NAME
4977
```
5078

5179
2. [Build WebKit](http://webkit.org/building/build.html)
@@ -54,7 +82,7 @@ git checkout -b purple_css_values
5482
Tools/Scripts/build-webkit --release
5583
```
5684

57-
A clean build takes 20-80 minutes depending on the vintage of your machine.
85+
A clean build takes between a few minutes up to more than an hour depending on your machine.
5886

5987
3. [Run it](http://webkit.org/building/run.html)
6088

docs/Deep Dive/Web Inspector/WebInspectorDebugging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Debugging the Web Inspector
1+
# Debugging Web Inspector
22

3-
This page contains tips and suggested workflows for isolating, understanding, and fixing code in the Web Inspector, particularly in the user interface.
3+
This page contains tips and suggested workflows for isolating, understanding, and fixing code in Web Inspector, particularly in the user interface.
44

55
## Inspecting the Inspector
66

docs/Deep Dive/Web Inspector/WebInspectorTests.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Writing Web Inspector Tests
22

3-
This page describes how various parts of the Web Inspector are tested.
3+
This page describes how various parts of Web Inspector are tested.
44

55
-----
66

@@ -13,7 +13,7 @@ There are several types of inspector tests:
1313
* **Manual Tests** exercise the user interface in ways that are difficult to automate or require infrastructure that doesn't exist yet.
1414
* **Library Tests** exercise subsystems such as pretty printing or the protocol generator in isolation from a running Web Inspector instance.
1515

16-
To date, the Web Inspector has no automated tests that exercise the user interface. In practice, the Inspector UI changes frequently, so such tests tend to be brittle, and have traditionally not been worth the trouble of maintaining.
16+
Web Inspector does not have automated tests that exercise the user interface. In practice, the Inspector UI changes frequently, so such tests tend to be brittle, and have traditionally not been worth the trouble of maintaining.
1717

1818
## How Tests Execute
1919

@@ -99,7 +99,7 @@ An `AsyncTestSuite` executes its test cases asynchronously, one after another, b
9999

100100
## How to Debug Tests
101101

102-
In general, the strategies for [wiki:"WebInspectorDebugging" debugging the Web Inspector] and debugging WebCore/WebKit2 apply the same to debugging inspector tests. Sometimes, tests can be more difficult to debug because the test harness' marshalling code can be broken by incorrectly written tests or bugs in the test harness. The test stubs provide several flags that enable extra or more reliable logging for debug purposes. Flags can be set in the corresponding `Test/TestStub.html` file for all test runs, or at the top of a `test()` method to only affect one test.
102+
In general, the strategies for [wiki:"WebInspectorDebugging" debugging Web Inspector] and debugging WebCore/WebKit2 apply the same to debugging inspector tests. Sometimes, tests can be more difficult to debug because the test harness' marshalling code can be broken by incorrectly written tests or bugs in the test harness. The test stubs provide several flags that enable extra or more reliable logging for debug purposes. Flags can be set in the corresponding `Test/TestStub.html` file for all test runs, or at the top of a `test()` method to only affect one test.
103103

104104
For protocol tests:
105105

0 commit comments

Comments
 (0)