Closed Bug 1147924 Opened 10 years ago Closed 6 years ago

[e10s] test/test-selection.js causes unsafe CPOW usage warnings

Categories

(Add-on SDK Graveyard :: General, defect, P4)

defect

Tracking

(e10s+)

RESOLVED INCOMPLETE
Tracking Status
e10s + ---

People

(Reporter: mconley, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [unsafe-cpow-usage] triaged)

+++ This bug was initially created as a clone of Bug #1147905 +++ Mined from test logs In addon-sdk/source/test/test-selection.js: https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l101 /** * Reload the window given and return a promise, that will be resolved with the * content window after a small delay. */ function reload(window) { let { promise, resolve } = defer(); // Here we assuming that the most recent browser window is the one we're // doing the test, and the active tab is the one we just opened. let tab = tabs.activeTab; tab.once("ready", function () { resolve(window); }); window.location.reload(true); <-- causes unsafe CPOW usage warning return promise; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l142 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l144 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l155 /** * Hide the frame in order to destroy the selection object, and show it again * after ~500 msec, to give time to attach the code on `document-shown` * notification. * In the process, call `Cu.forgeGC` to ensure that the `document-shown` code * is not garbaged. */ function hideAndShowFrame(window) { let { promise, resolve } = defer(); let iframe = window.document.querySelector("iframe"); <-- causes unsafe CPOW usage warning iframe.style.display = "none"; <-- causes unsafe CPOW usage warning Cu.schedulePreciseGC(function() { events.on("document-shown", function shown(event) { if (iframe.contentWindow !== event.subject.defaultView) return; events.off("document-shown", shown); setTimeout(resolve, 0, window); }, true); iframe.style.display = ""; <-- causes unsafe CPOW usage warning }); return promise; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l165 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l166 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l167 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l169 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l170 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l172 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l173 /** * Select the first div in the page, adding the range to the selection. */ function selectFirstDiv(window) { let div = window.document.querySelector("div"); <-- causes unsafe CPOW usage warning let selection = window.getSelection(); <-- causes unsafe CPOW usage warning let range = window.document.createRange(); <-- causes unsafe CPOW usage warning if (selection.rangeCount > 0) <-- causes unsafe CPOW usage warning selection.removeAllRanges(); <-- causes unsafe CPOW usage warning range.selectNode(div); <-- causes unsafe CPOW usage warning selection.addRange(range); <-- causes unsafe CPOW usage warning return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l182 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l183 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l185 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l186 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l188 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l189 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l191 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l192 /** * Select all divs in the page, adding the ranges to the selection. */ function selectAllDivs(window) { let divs = window.document.getElementsByTagName("div"); <-- causes unsafe CPOW usage warning let selection = window.getSelection(); <-- causes unsafe CPOW usage warning if (selection.rangeCount > 0) <-- causes unsafe CPOW usage warning selection.removeAllRanges(); <-- causes unsafe CPOW usage warning for (let i = 0; i < divs.length; i++) { <-- causes unsafe CPOW usage warning let range = window.document.createRange(); <-- causes unsafe CPOW usage warning range.selectNode(divs[i]); <-- causes unsafe CPOW usage warning selection.addRange(range); <-- causes unsafe CPOW usage warning } return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l202 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l203 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l205 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l206 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l208 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l209 /** * Select the textarea content */ function selectTextarea(window) { let selection = window.getSelection(); <-- causes unsafe CPOW usage warning let textarea = window.document.querySelector("textarea"); <-- causes unsafe CPOW usage warning if (selection.rangeCount > 0) <-- causes unsafe CPOW usage warning selection.removeAllRanges(); <-- causes unsafe CPOW usage warning textarea.setSelectionRange(0, textarea.value.length); <-- causes unsafe CPOW usage warning textarea.focus(); <-- causes unsafe CPOW usage warning return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l218 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l219 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l220 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l222 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l223 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l225 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l226 /** * Select the content of the first div */ function selectContentFirstDiv(window) { let div = window.document.querySelector("div"); <-- causes unsafe CPOW usage warning let selection = window.getSelection(); <-- causes unsafe CPOW usage warning let range = window.document.createRange(); <-- causes unsafe CPOW usage warning if (selection.rangeCount > 0) <-- causes unsafe CPOW usage warning selection.removeAllRanges(); <-- causes unsafe CPOW usage warning range.selectNodeContents(div); <-- causes unsafe CPOW usage warning selection.addRange(range); <-- causes unsafe CPOW usage warning return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l239 /** * Dispatch the selection event for the selection listener added by * `nsISelectionPrivate.addSelectionListener` */ function dispatchSelectionEvent(window) { // We modify the selection in order to dispatch the selection's event, by // contract the selection by one character. So if the text selected is "foo" // will be "fo". window.getSelection().modify("extend", "backward", "character"); <-- causes unsafe CPOW usage warning return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l249 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l250 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l251 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l253 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l255 /** * Dispatch the selection event for the selection listener added by * `window.onselect` / `window.addEventListener` */ function dispatchOnSelectEvent(window) { let { document } = window; <-- causes unsafe CPOW usage warning let textarea = document.querySelector("textarea"); <-- causes unsafe CPOW usage warning let event = document.createEvent("UIEvents"); <-- causes unsafe CPOW usage warning event.initUIEvent("select", true, true, window, 1); <-- causes unsafe CPOW usage warning textarea.dispatchEvent(event); <-- causes unsafe CPOW usage warning return window; } ... https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l266 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l268 https://hg.mozilla.org/projects/holly/file/50e197279ad5/addon-sdk/source/test/test-selection.js#l269 /** * Creates empty ranges and add them to selections */ function createEmptySelections(window) { selectAllDivs(window); let selection = window.getSelection(); <-- causes unsafe CPOW usage warning for (let i = 0; i < selection.rangeCount; i++) <-- causes unsafe CPOW usage warning selection.getRangeAt(i).collapse(true); <-- causes unsafe CPOW usage warning }
tracking-e10s: m8+ → ---
Whiteboard: [unsafe-cpow-usage]
This is test only.
tracking-e10s: --- → +
Summary: [e10s] page-mod-debugger-post/main.js causes unsafe CPOW usage warnings → [e10s] test/test-selection.js causes unsafe CPOW usage warnings
we are going to check which tests pass - and then disable all that do not to detect breakages from this point on. correcting the test suite issue across the board is a months long effort - that doesn't align with 2017 plans.
Priority: P1 → P4
Whiteboard: [unsafe-cpow-usage] → [unsafe-cpow-usage] triaged
Add-on SDK is no longer supported so resolving bugs as INCOMPLETE
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.