/**
 * Filters debugger targets that we can use
 */

exports.isCorrectTarget = function (target) {
  return isSuitableType(target)
    && !isDevtools(target)
    && !isAutotesterBg(target)
    && !isAutotesterUi(target);
};

function isSuitableType(target) {
  // allowing 'background_page' type is extra feature to test chrome extensions
  return target.type === 'page' || target.type === 'background_page';
}

function isDevtools(target) {
  return target.url.startsWith('chrome-devtools://');
}

function isAutotesterBg(target) {
  return target.type === 'background_page' && target.extensionId === chrome.runtime.id;
}

function isAutotesterUi(target) {
  return target.type === 'page' && target.url === chrome.runtime.getURL('ui/ui.html');
}

@@ -46,16 +46,273 @@
 se%0A */%0A%0A
+/**%0A * We also exclude chromedriver internal extension from available targets%0A * See: https://chromium.googlesource.com/chromium/src.git/+/master/chrome/test/chromedriver/extension/%0A */%0Aconst CHROMEDRIVER_EXTENSION_ID = 'aapnijgdinlhnhlmodcfapnahmbfebeb';%0A%0A
 exports.
@@ -431,32 +431,74 @@
 esterBg(target)%0A
+    && !isChromedriverExtensionBg(target)%0A
     && !isAutote
@@ -912,24 +912,168 @@
 time.id;%0A%7D%0A%0A
+function isChromedriverExtensionBg(target) %7B%0A  return target.type === 'background_page' && target.extensionId === CHROMEDRIVER_EXTENSION_ID;%0A%7D%0A%0A
 function isA
@@ -1177,14 +1177,15 @@
 /ui.html');%0A
-
 %7D%0A
+%0A

exclude chromedriver extension