AutomaApp / automa

A browser extension for automating your browser by connecting blocks
https://www.automa.site
Other
10.73k stars 1.09k forks source link

as Loop Element Blocks, build `loopItems` , use document problematic, when selecter is 'iframe |> .className' #1663

Open Lupeiwen0 opened 4 months ago

Lupeiwen0 commented 4 months ago

Describe the bug as Loop Element Blocks, build loopItems , use document problematic, when selecter is 'iframe |> .className'

To Reproduce of source code

//    src/content/blocksHandler/handlerLoopElements.js   line 64

const loopItems = document.querySelectorAll(
  `[automa-loop*="${data.loopAttrId}"]`
);
if (loopItems.length === 0) return { continue: true };

Opts: The getScrollParent function, node instanceof HTMLElement this HTMLElement should check iframe again

//    src/content/blocksHandler/handlerLoopElements.js   line 6

function getScrollParent(node) {
  const isElement = node instanceof HTMLElement;
  const overflowY = isElement && window.getComputedStyle(node).overflowY;
  const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';

 // ...
}

Expected behavior should not use document directly. You should check if iframe is used and then select whether the document points to iframe instance

Desktop (please complete the following information):