Closed
Bug 1470044
Opened 6 years ago
Closed 6 years ago
Copy persisted attributes from xulStore.json when loading overlays
Categories
(MailNews Core :: XUL Replacements, enhancement)
MailNews Core
XUL Replacements
Tracking
(thunderbird62 fixed, thunderbird63 fixed)
RESOLVED
FIXED
Thunderbird 63.0
People
(Reporter: darktrojan, Assigned: darktrojan)
References
Details
Attachments
(1 file, 2 obsolete files)
3.92 KB,
patch
|
Fallen
:
review+
jorgk-bmo
:
approval-comm-beta+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•6 years ago
|
||
As mentioned in bug 1448808 comment 40, this patch applies the persisted attributes to the nodes before adding them to the document. I'm not 100% sure I've done this at the right point, but it does seem to work.
Attachment #8986642 -
Flags: review?(philipp)
Attachment #8986642 -
Flags: feedback?(patrick)
Comment 2•6 years ago
|
||
Comment on attachment 8986642 [details] [diff] [review] 1470044-persist-1.diff Seems to be alright (without testing it)
Attachment #8986642 -
Flags: feedback?(patrick) → feedback+
Comment 3•6 years ago
|
||
Comment on attachment 8986642 [details] [diff] [review] 1470044-persist-1.diff Review of attachment 8986642 [details] [diff] [review]: ----------------------------------------------------------------- r=me with comments considered ::: common/src/Overlays.jsm @@ +56,4 @@ > this.window = window; > + > + this.location = window.location.protocol + "//" + > + window.location.host + window.location.pathname; Could you use window.location.origin + window.location.pathname ? @@ +61,5 @@ > + this.persistenceIDs = []; > + let ids = xulStoreService.getIDsEnumerator(this.location); > + while (ids.hasMore()) { > + this.persistenceIDs.push(ids.getNext()); > + } Loading all ids seems like it could be a performance hit, does it make sense to cache/reuse this in some way? @@ +262,5 @@ > * @param {Element} node The node to insert. > */ > _insertElement(parent, node) { > + let loadPersistentAttributes = (element) => { > + if (this.persistenceIDs.includes(element.id)) { If persistenceIDs is an array this is O(n), maybe you could use new Set() instead to make it O(1)
Attachment #8986642 -
Flags: review?(philipp) → review+
Assignee | ||
Comment 4•6 years ago
|
||
Unfortunately my code was running too early and didn't quite work for some things, so I've moved it. It's also a lot tidier here.
Attachment #8986642 -
Attachment is obsolete: true
Attachment #8989308 -
Flags: review?(philipp)
Comment 5•6 years ago
|
||
Comment on attachment 8989308 [details] [diff] [review] 1470044-persist-2.diff Review of attachment 8989308 [details] [diff] [review]: ----------------------------------------------------------------- I believe this needs another round, please see the following comments: ::: common/src/Overlays.jsm @@ +15,5 @@ > ChromeUtils.defineModuleGetter(this, "setTimeout", "resource://gre/modules/Timer.jsm"); > > Cu.importGlobalProperties(["XMLHttpRequest"]); > > +let xulStoreService = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore); Can you make this a lazy getter? @@ +172,5 @@ > // Now here is where it gets a little tricky. The subscript loader is synchronous, but the > // script itself may have some asynchronous side-effects (xbl bindings attached). Throwing in a > // 1500ms timeout before we fire the load handlers seems to help, even though it is an ugly hack. > setTimeout(() => { > + let ids = xulStoreService.getIDsEnumerator(this.location); Note this code only runs when the window is already loaded, which was originally thought for loading overlays on the fly into already open windows. The latest ext-legacy.js code should be loading the overlay before the window load is complete, because it only triggers on startup and before dialogs are completely loaded. Could you test this for both cases and also find the right time to load the xul store state for not yet loaded windows?
Attachment #8989308 -
Flags: review?(philipp) → review-
Comment 6•6 years ago
|
||
Also, see previous review comments from comment 3. Let me know if I missed something.
Assignee | ||
Comment 7•6 years ago
|
||
(In reply to Philipp Kewisch [:Fallen] from comment #5) > Note this code only runs when the window is already loaded, which was > originally thought for loading overlays on the fly into already open > windows. The latest ext-legacy.js code should be loading the overlay before > the window load is complete, because it only triggers on startup and before > dialogs are completely loaded. Unless I'm reading it wrong, the overlays are never added before the window loads. The extensionSupport window listener waits for the load event before calling back.
Comment 8•6 years ago
|
||
Hmm you are right, it does. This could explain some of the race conditions I was experiencing. When I developed the patch, the code was mostly getting called before the readyState was completed, and before some other load handlers like the one that takes the toolbarpalette out of the window was not called. I guess it was all a coincidence, but it was helpful since the random timeout was not great. Maybe it would be worth trying to execute the overlay loader code a little earlier, e.g. on DOMContentLoaded.
Assignee | ||
Comment 9•6 years ago
|
||
Please have another look at this after you've reviewed bug 1474248. This is actually earlier on my patch queue, but I think what I'm doing there answers the concerns you had here.
Attachment #8989308 -
Attachment is obsolete: true
Attachment #8991253 -
Flags: review?(philipp)
Comment 10•6 years ago
|
||
Comment on attachment 8991253 [details] [diff] [review] 1470044-persist-3.diff Review of attachment 8991253 [details] [diff] [review]: ----------------------------------------------------------------- I recall reading some of this in another patch. Looks fine :)
Attachment #8991253 -
Flags: review?(philipp) → review+
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Comment 11•6 years ago
|
||
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/70ce87dcbe19 Copy persisted attributes from xulStore.json when loading overlays. r=philipp DONTBUILD
Updated•6 years ago
|
Target Milestone: --- → Thunderbird 63.0
Updated•6 years ago
|
Attachment #8991253 -
Flags: approval-comm-beta+
Comment 12•6 years ago
|
||
Beta (TB 62): https://hg.mozilla.org/releases/comm-beta/rev/ba4452fb46ee4988525d703da7db58b4c56426fa
status-thunderbird62:
--- → fixed
status-thunderbird63:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•