Advanced

An off switch as a written state

An extension that cannot be turned off is an extension that cannot be reviewed. The switch is a state, and a state is a name that survives a reload.

What you will see

One line with the state. Shown is what a reviewer reads.

About 1 min of reading

Try It

Prove off does nothing

1

Write the state

printf 'example.com off\n' > /tmp/s.txt; cat /tmp/s.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One host with one state. Per host is the smallest switch.
2

Read before run

printf 'off\n' | awk '{print ($1=="off") ? "nothing changed" : "run"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
nothing changed. Off is the default, which is why it is safe.
3

Show the state

printf 'state off host example.com\n' > /tmp/t.txt; tail -1 /tmp/t.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
One line with the state. Shown is what a reviewer reads.

Data Flow

A switch to a run that may do nothing
1 The state is written per host
↓
2 The state is read before the run
↓
3 Off runs nothing and says so
↓
4 The state is shown as text
Why this works
Why the switch is not a removal

A removal is a different install. A state is the same install, and the same install is what a review is about.

The one state that must be the default

Off. Off as default is why an install that is never opened changes nothing.

Examples

The switch is per host

Per host is the smallest switch. A smallest switch is a switch that leaves the rest of the web alone.

The state is read before the run

Before is the order. The order is why an off extension does nothing at all.

The state is shown

Shown as text in the page. Shown is what makes a reviewer see the state without a tool.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Parts talking as a named channel
Previous Lesson
Parts talking as a named channel
Next Lesson
Testing a content script as a fixture
Testing a content script as a fixture →