INNER CODE UNIT · JavaScript

isFrameLoaded

mozilla/firefox-translations · extension/controller/backgroundScript.js:109

const isFrameLoaded = async (tabId, frameId) => {
  let loadedFrames = await browser.webNavigation.getAllFrames({ tabId });
  for (let frame of loadedFrames) {
    if (frame.frameId === frameId) return true;
  }
  return false;
}

const onError = error => {
  // this means frame is already unloaded. Even though we check it, race conditions are still possible
  if (error.message.endsWith("Could not establish connection. Receiving end does not exist.")) {
    console.warn(error);
  } else throw error;
}

const submitPing = tabId => {
  if (pingByTab.has(tabId)) {
    getTelemetry(tabId).submit();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…