Skip to content
All writing ‹ Part 09 of 11 · Mobile Debugging: When There Is No DevTools
Engineering · 3 min read

One Tap Passes Six Layers: Remove One Layer per Test

One tap inside an app passes six layers, from the app down to the ad's click script. How one control per layer finds the layer that stops the tap.

On the web, a tap usually meets one page. Inside an app, the same tap passes through six layers, and any of them can stop it.

The stack

Six nested layers around one tap Six boxes nest inside each other: the affected app, the ad SDK, WKWebView, the feed page, an iframe, and the ad HTML with its click script. The tap lands in the innermost box. affected app ad SDK WKWebView feed page iframe ad HTML + click script tap
The tap lands in the innermost box, but every box around it gets the tap too, and any of them can stop it.

The SDK is the ad library that the app builds in. The WKWebView is a browser engine inside the app. The feed is the scrolling list of posts and ads.

Each layer gets the tap. Each layer can open a page, stop the open, or ignore it. A failure in the full stack does not tell you which layer failed.

Controls remove one layer at a time

A control is a second test that differs from the failing one in one known way. If the control works, the cause is in that difference. So pick each control to remove or swap exactly one layer.

Control Result What it rules out
Same ad HTML in Safari, no app layers the advertised app opened the ad HTML and the landing link
A feed post that the app draws itself, same feed in-app Safari opened “this app cannot open pages”
Another plain image ad from the same ad network, same feed in-app Safari opened “this network’s ads fail here”
Another network’s ad with a plain <a target="_blank"> in-app Safari opened “links in this WebView fail”

In the example

After these four controls, one difference was left: how the failing ad itself opens the page. That pointed at its click script (the ad’s JavaScript that records the tap and opens the ad’s page). A log added at the tap then showed window.open() returning null and defaultPrevented: true. The details are in Same Code, Different App Host.

Controls narrow the search. They do not prove a cause. Before that, the team had a guess that fit every fact, and it was wrong: Try to Disprove Your Own Guess First.

When the stack is deep, do not guess the layer. Remove the layers one by one.


Related: see why the same code behaves differently inside an app host, why a proxy rewrite proves only the phone side, why you try to disprove your own guess first, and the series takeaway: check one layer at a time with the right tool. Or go Back to the series overview.

↑↓ navigate ↵ open esc close