-
Notifications
You must be signed in to change notification settings - Fork 128
Conversation
@ianb It seems like setting the iframe's contentDocument innerHTML works equivalently to the previous use of DOMParser (see most recent commit, 7f03043). The html document inside the iframe is now not fully replaced when the overlay is rendered, but if I take multiple screenshots without reloading a content page, I don't see any errors related to multiple copies of scripts or handlers running in the iframe. Thoughts? |
7f03043
to
ded7390
Compare
Rebased against current master |
@@ -29,8 +31,8 @@ window.auth = (function () { | |||
|
|||
function generateRegistrationInfo() { | |||
let info = { | |||
deviceId: "anon" + makeUuid() + "", | |||
secret: makeUuid()+"", | |||
deviceId: `anon ${makeUuid()}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a space into the string, so anon UUID
instead of anonUUID
@@ -13,7 +15,7 @@ window.analytics = (function () { | |||
return Promise.resolve(); | |||
} | |||
if (! telemetryPref) { | |||
console.info(`Cancelled sendEvent ${eventCategory}/${action}/${label || 'none'} ${JSON.stringify(options)}`); | |||
dump(`Cancelled sendEvent ${eventCategory}/${action}/${label || 'none'} ${JSON.stringify(options)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #2604 for this, which I would prefer to dump()
@@ -108,11 +110,6 @@ window.main = (function () { | |||
title: browser.i18n.getMessage("contextMenuLabel"), | |||
contexts: ["page"], | |||
documentUrlPatterns: ["<all_urls>"] | |||
}, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this catcher is the only way to catch an error from contextMenu, unlike some of the other uses of lastError
.
console.error(e.stack); | ||
exports.unhandled(makeError(e)); | ||
throw e; | ||
}); | ||
}; | ||
|
||
exports.registerHandler = function (h) { | ||
if (handler) { | ||
console.error("registerHandler called after handler was already registered"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have catcher.unhandled(new Exception("registerHandler called after handler was already registered"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take that back, catcher calling catcher will lead to bad things
f7239ca
to
37c23a2
Compare
} else { | ||
num = Math.floor(Math.random() * 46656); | ||
num = Math.floor(Math.random() * Math.pow(36, 3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these ids need to be globally unique or just within a single account? If global, can we use crypto
here? Date.now()
and Math.random()
make me nervous here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only want the ids for clips generated within a single shot to not conflict. This isn't used for any security-conscious situation. Things like clip image URLs are generated with UUIDs on the server.
@ianb Should I merge this, or do you want to leave it open till Kris finishes responding to the review? |
@6a68 I think Kris can still leave comments after it closes, and it's already bitrotting, let's get it landed |
👍 I"ll squash, rebase and land and push the fixes commit to the PR branch Kris is looking at |
Addresses review comment #2471 (comment)
Addresses review comment #2471 (comment)
Addresses comments 2 and 3 inside selector/ui.js
Addresses selector/documentMetadata.js comment 1 #2471 (comment)
Addresses selector/shooter.js comment 1 #2471 (comment)
Addresses shared/shot.js comment 1 #2471 (comment)
- add onActivated listener to ensure the button state is properly toggled when switching between tabs
TODO: investigate executeScript return value...
…into iframe" This reverts commit 224927a0b072d2bfb851e6b45ac0ed367ab6bb93.
549a61b
to
7fc0e61
Compare
* Add strict mode statement to all files Addresses review comment #2471 (comment) * Do not assign properties to `window`. Addresses review comment #2471 (comment) * Use docElement.outerHTML, not DOMParser, to insert html page into iframe Addresses comments 2 and 3 inside selector/ui.js * Use for..of instead of for-loop Addresses selector/documentMetadata.js comment 1 #2471 (comment) * Replace IIFE with block scope, yay es6 Addresses selector/shooter.js comment 1 #2471 (comment) * Use spread/rest operators to simplify assert() fn logic Addresses shared/shot.js comment 1 #2471 (comment) * WIP fixes to shared/shot * Nit - replace let..in with let..of * Nit: replace foo+"" with String(foo) * nits related to catcher.js * auth updates * review changes to main.js - add onActivated listener to ensure the button state is properly toggled when switching between tabs * selectorLoader changes TODO: investigate executeScript return value... * last few review nits * Revert "Use docElement.outerHTML, not DOMParser, to insert html page into iframe" This reverts commit 224927a0b072d2bfb851e6b45ac0ed367ab6bb93. * Use innerHTML: outerHTML throws a NoModificationAllowedError * Please the linter * Fix #2596, address review nit in randomString.js * Remove space in deviceId generation * Restore lastError handler for contextMenus.create * Rename shot.js makeUuid to more accurate makeRandomId * Fix #2603, abstract out sendToBootstrap error checking
This seems to be working fine for me locally. The outerHTML commit is reverted, I'll work on fixing that right now.
Still unaddressed things from the big review:
cloneInto
(line 16, kinda seems optional IMO)edited to add bug numbers
[Ian] Also added:
error.message
checkmoz-extension:
iframe