fix: approval windows open as wide as the page (closes #518)
The approval window was opened 360 pixels wide while the page is 396, so it scrolled sideways and cut off the Reject button. It now opens at 396. Both browsers count the window's frame in that width, so the approval page also widens its own window by however far it would scroll sideways; the toolbar popup's window is left alone. The Firefox suite checks that the sign prompt does not scroll sideways. The Chrome suite cannot: its approval windows open at 1280x720 whatever size is asked. README's Visual Style line, which still said 360x600, now gives the page's real width. Model: opus-5-5
This commit is contained in:
@@ -242,6 +242,11 @@ async function settle() {
|
||||
* "?approval=" and an id for the popup opened as an approval window.
|
||||
* @param {object} [options.runtime] members of chrome.runtime that replace the
|
||||
* stub's own, for a test that has to answer the background's messages.
|
||||
* @param {object} [options.windows] chrome.windows, for a test of the approval
|
||||
* window resizing itself.
|
||||
* @param {object} [options.documentElement] members of document.documentElement
|
||||
* that replace the stub's own: scrollWidth and clientWidth, which are equal
|
||||
* unless a test says otherwise, so the page does not scroll sideways.
|
||||
* @returns {Promise<object>} handles onto the booted page.
|
||||
*/
|
||||
async function bootPopup(stored, options) {
|
||||
@@ -277,6 +282,11 @@ async function bootPopup(stored, options) {
|
||||
(options && options.storage) ||
|
||||
makeStorageStub(stored === undefined ? {} : { autistmask: stored });
|
||||
const document = makeDocument(POPUP_HTML);
|
||||
Object.assign(
|
||||
document.documentElement,
|
||||
{ scrollWidth: 396, clientWidth: 396 },
|
||||
options && options.documentElement,
|
||||
);
|
||||
const reloads = [];
|
||||
|
||||
globalThis.chrome = {
|
||||
@@ -287,6 +297,7 @@ async function bootPopup(stored, options) {
|
||||
onMessage: { addListener: () => {} },
|
||||
...(options && options.runtime),
|
||||
},
|
||||
windows: options && options.windows,
|
||||
};
|
||||
globalThis.document = document;
|
||||
globalThis.window = {
|
||||
|
||||
Reference in New Issue
Block a user