wildskyf / TextareaCache

Browser Add-on: Automatically save the content in Textarea.
MIT License
66 stars 7 forks source link

TextareaCache breaks Trello editing #41

Closed FelixSchwarz closed 6 years ago

FelixSchwarz commented 6 years ago

Since a few days/weeks I can not use Trello anymore when TCL is enabled.

How to reproduce:

-> nothing happens (should see an edit interface), JS errors in the console.

borama commented 6 years ago

Same problem here, tracked it down to TextareaCache extension. Had to disable it for now.

The problem seems to be related with an attempt to access some information without permission, possibly via an iframe.

Error messages from the JS console:

Error: Permission denied to access property "apply"  ltp.js:8:22197
^--- With additional stack trace: [558]</p</t.prototype.ensureSubviews@https://a.trellocdn.com/js/5ac5acc7d9355374bcb4f1d6f701d929/app.js:45:9743
[445]</v</t.prototype.renderAttachments/this._renderAttachmentsPromise</<@https://a.trellocdn.com/js/5ac5acc7d9355374bcb4f1d6f701d929/app.js:37:9191
i@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:31888
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromiseFromHandler@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:5022
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromiseAt@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:6281
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromises@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:8146
require<.bluebird</</</<[2]</a.prototype._drainQueue@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:2269
require<.bluebird</</</<[2]</a.prototype._drainQueues@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:2327
a/this.drainQueues@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:542
  ltp.js:19:11563
TypeError: o is undefined  app.js:45:9743
^--- With additional stack trace: [558]</p</t.prototype.ensureSubviews@https://a.trellocdn.com/js/5ac5acc7d9355374bcb4f1d6f701d929/app.js:45:9743
[445]</v</t.prototype.renderAttachments/this._renderAttachmentsPromise</<@https://a.trellocdn.com/js/5ac5acc7d9355374bcb4f1d6f701d929/app.js:37:9191
i@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:31888
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromiseFromHandler@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:5022
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromiseAt@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:6281
require<.bluebird</</</<[23]</t.exports/t.prototype._settlePromises@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:20:8146
require<.bluebird</</</<[2]</a.prototype._drainQueue@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:2269
require<.bluebird</</</<[2]</a.prototype._drainQueues@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:2327
a/this.drainQueues@https://a.trellocdn.com/js/b1caa7ee0cdf52b82ef5015c55169c27/ltp.js:19:542
  ltp.js:19:11563
TypeError: o is undefined  app.js:45:9743

Firefox provides a link to this page for more info about the first error (with the apply property).

wildskyf commented 6 years ago

Got you, I will check it this weekend. Thank you for reporting.

wildskyf commented 6 years ago

Hi, @FelixSchwarz and @borama

I can't reproduce this problem in my firefox57@fedora26... Could you please open another profile and test it? Just firefox -P in your gnome-terminal.

by the way, #3 is finished, so you could add trello.com into your exception list, but please help me to find the problem first 😺, thank you!!

borama commented 6 years ago

Hi @FelixSchwarz ,

it indeed seems to be quite hard to reproduce. I created a new profile in Firefox 57, installed the addon, registered a blank new account in Trello and everything worked very well at first.

I played around with cards, columns and boards and it still worked.

The only time I was able to reproduce the bad behavior was when I created a new team and assigned the board to the team and then removed it from the team again. I also had to fiddle with the Privacy setting of the board, had to make it Public or Team-visible and then back to Private. Suddenly (and I am afraid I can't give you the exact step by step procedure but I managed to break it 3 times in a row now) a red bubble appeared saying Trello can't connect with the server and suggesting me to reload the page. And this is the moment when things go wrong and even a reload of the page does not help. What helps for me now though is restarting the browser (OTOH in my main Trello account even restarting browser does not help).

Hope this helps, 🤞

wildskyf commented 6 years ago

thx @borama! your information is very detailed, I will try it again when I have time! thank you!!

puxlit commented 6 years ago

We're experiencing a similar incompatibility between Textarea Cache and New XKit; see new-xkit/XKit#1476.

AFACT, it boils down to Textarea Cache assigning handlers to onfocus/onblur (for the input elements in which it is interested), which renders these properties inaccessible to other JS contexts. The typical pattern used to determine whether these handlers are assigned is handler && handler.apply; handler is truthy even if Inaccessible, whilst handler.apply will fail with a permission error.

Here's a contrived minimal example.

<!DOCTYPE html><html><body>
<textarea>Lorem ipsum</textarea>
<button>Call blur event handler</button>
<script>
// Native version
document.querySelector("button").addEventListener("click", (event) => {
    const ta = document.querySelector("textarea");
    if (ta && ta.onblur && ta.onblur.apply) ta.onblur.apply(ta, [{}]);
});

// jQuery version
// $("button").click(function () {
//     $("textarea").blur();
// });
</script>
</body></html>

With Textarea Cache installed, our event handler fails with Error: Permission denied to access property "apply".

Chrome better isolates on-event handlers between pages and content scripts, so this appears to be a Firefox issue, and was reported to BMO as #1330113.

wildskyf commented 6 years ago

Hi all,

54 seems to be similar to this issue, and I also found the problem is the onfocus and onblur.

I have replaced it with addEventListener, so please help me to check whether this issue is still there. thanks!!

puxlit commented 6 years ago

Can confirm your changes have resolved the conflict with New XKit. :)

borama commented 6 years ago

Just tested on our company Trello and so far everything looks good with Textarea Cache 3.5.0! Thanks! 👍

FelixSchwarz commented 6 years ago

This works for me as well so I'm closing the ticket now. :-)

wildskyf commented 6 years ago

Great, feel free to reopen or raise another issue if you found any other problems!