MCPcopy
hub / github.com/philc/vimium / activateMode

Function activateMode

content_scripts/link_hints.js:248–272  ·  view source on GitHub ↗
({ frameId, frameIdToHintDescriptors, modeIndex, originatingFrameId })

Source from the content-addressed store, hash-verified

246 // process proceeds in lock step in every frame, and this.linkHintsMode is in the same state in
247 // every frame.
248 activateMode({ frameId, frameIdToHintDescriptors, modeIndex, originatingFrameId }) {
249 // We do not receive the frame's own hint descritors back from the background page. Instead, we
250 // merge them with the hint descriptors from other frames here. Note that
251 // this.localHintDescriptors can be null if "getHintDescriptors" failed in this frame when it
252 // was last called, or if this frame didn't exist at the time that hints were requested.
253 frameIdToHintDescriptors[frameId] = this.localHintDescriptors || [];
254 this.localHintDescriptors = null;
255
256 const hintDescriptors = Object.keys(frameIdToHintDescriptors)
257 .sort()
258 .flatMap((frame) => frameIdToHintDescriptors[frame]);
259
260 if (this.cacheAllKeydownEvents?.modeIsActive) {
261 this.cacheAllKeydownEvents.exit();
262 }
263 if (frameId !== originatingFrameId) {
264 this.onExit = [];
265 }
266 this.linkHintsMode = new LinkHintsMode(hintDescriptors, availableModes[modeIndex]);
267 // Replay keydown events which we missed (but for filtered hints only).
268 if (Settings.get("filterLinkHints" && this.cacheAllKeydownEvents)) {
269 this.cacheAllKeydownEvents.replayKeydownEvents();
270 }
271 this.cacheAllKeydownEvents = null;
272 },
273
274 // The following messages are exchanged between frames while link-hints mode is active.
275 updateKeyState(request) {

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
replayKeydownEventsMethod · 0.80
exitMethod · 0.45

Tested by

no test coverage detected