ibnishak / Timimi

Webextension to save Tiddlywiki
https://ibnishak.github.io/Timimi/
GNU Affero General Public License v3.0
206 stars 23 forks source link

TWC file contaminated somewhat #27

Open PengjuYan opened 5 years ago

PengjuYan commented 5 years ago

Thank you @YakovL and @ibnishak for making Timimi and making it work for TiddlyWiki classic (#23).

Though, there're some problems in the resulting TWC file what the previous plugins (although they don't work any more) won't produce. In short, the original clean TWC file is "contaminated" somewhat. Although it doesn't block TWC or Timimi from working, it's still better if we keep the file content to be original.

If you compare the original clean TWC file and a updated file saved by Timimi, you will see 3 unwanted differences (other than the <storeArea>):

  1. The <title> element is filled in with "My TiddlyWiki - a reusable ...".
  2. The name of injected patch-classic-io.js appears in <head>.
  3. The injected tiddlyfox-message-box <div> appears at the end of <body>.
YakovL commented 5 years ago

Hi, could you specify the version of TWC you are using? I've tested the latest version of Timimi (modified in dev mode) with 2.9.2 and the message box is removed there, so it's essential to get a way to reproduce the issue to fix it

PengjuYan commented 5 years ago

I tested by using a freshly downloaded (just downloaded before I did the test) 2.9.2 version. And my FireFox version is 68.0.1 on macOS.

(Just a reminder: As I mentioned in #23, it's possible that "FireFox + approved add-on" and "web-ext FireFox + you local add-on" may behave differently.)

YakovL commented 5 years ago

Ok, thanks for reporting. Unfortunatelly I probably won't be able to test and start debugging this until Monday; could you test whether the "contamination" is cumulative or not? (open TW, edit, save, reload TW, edit and save again: are those bits added only once or some are added twice?)

PengjuYan commented 5 years ago

Not cumulative. Just added only once.

ibnishak commented 5 years ago

@YakovL : May I assign this issue to you?

YakovL commented 5 years ago

@ibnishak yeap, no problem

YakovL commented 5 years ago

Hi @PengjuYan , could you check whether your FireFox has (in about:config) security.fileuri.strict_origin_policy disabled? I suspect that disabling it will stop contaminating (although won't undo it so you probably need to do that manually)

PengjuYan commented 5 years ago

Hi @YakovL , I tested by switching security.fileuri.strict_origin_policy from default true to false back and forth, and found that the "contaminating" disappears!

In concrete:

  1. Still there: The <title> element is filled in with "My TiddlyWiki - a reusable ...". This is benign.
  2. Disappeared: The name of injected patch-classic-io.js appears in <head>.
  3. Disappeared: The injected tiddlyfox-message-box <div> appears at the end of <body>.

In other words, the value of security.fileuri.strict_origin_policy doesn't effect the phenomenon. The problem has been fixed automatically (possibly by FireFox 68.0.2 ?).

My settings include:

  1. I'm now using FireFox version 68.0.2 on macOS instead of 68.0.1.
  2. TiddlyWiki classic version 2.9.2 unchanged.
  3. Timimi version 2.0.3 (I'm not sure about the Timimi version when I report this issue, my bad).

Shall I close this issue?

pmario commented 5 years ago

have a look at:https://groups.google.com/d/msg/tiddlywikidev/lWlZk9qKUH4/Id66zZhABQAJ

PengjuYan commented 4 years ago

@pmario Thank you Mario for pointing me to the discussion there. According to @pmario and @YakovL, seems like the problem lies in recreateOriginal and @pmario solved it in his amazing file-backups (back in 2017 when I was using file-backups I suffered the same problem and I switched to savetiddlers 0.6).

Is there any plan to fix this issue in Timimi for TWC?

I just reproduced this issue by using TWC 2.9.2 + Firefox 75.0 + macOS Catalina (10.15.4) once again.

ibnishak commented 4 years ago

Will look into it for the next upgrade.

YakovL commented 4 years ago

Couple of notes:

  1. (regarding title) this is actually the expected behavior, title is calced in accord to SiteTitle and SiteSubtitle on saving, this is not a contamination. Well, may be this needs retesting ("My TiddlyWiki - a reusable ..." is in accord to initial SiteTitle and SiteSubtitle values, but it should always be from the current values when they are different from initial ones)
  2. to be retested, the patch-classic-io.js script is expected to be removed from the head. If it is not, it should be investigated and fixed; in Chrome it will be removed slightly differently
  3. tiddlyfox-message-box is something that needs a closer look. First, it should probably be removed in recreateOriginal by TWC core (see backward compatibility notes by Mario in the thread he referenced). Second, I'm not sure if browser extensions should do anything about it. Chrome is very restrictive about XHRs via file:// scheme. Actually, the best approach would be to support file loading functionality by Timimi (backend and extension), but this is not yet something where I can contribute
PengjuYan commented 8 months ago

Hi @ibnishak and @YakovL , is there any plan to investigate the issue?

My TWC file keeps add patch-classic-io.js to the <head> section. I will have to open the .html file and clean it manually time by time after many patch-classic-io.js accumulated.

Reproduction environment:

Software Version
TiddlyWiki Classic 2.10.0
Firefox 122.0.1 (64-bit)
macOS 13.0.1

Reproduction result:

  1. Save TWC, then 1.1. A <div> id=tiddlyfox-message-box appears at the end of <body>. 1.2. A <script> with src=patch-classic-io.js appears at the end of <head>.
  2. Save once again, then nothing changes;
  3. Reload the TWC file and save again, then 3.1. Another <script> with src=patch-classic-io.js appears at the end of <head>.

That is to say, the <script> with src=patch-classic-io.js will be accumulated in the TWC file whenever you save it after a reload.

YakovL commented 8 months ago

Hi Pengju, well it wasn't planned before (or rather was somethere in the middle of my big backlog(s)), but may be I'll take a look for the next release. I've created a TW issue: https://github.com/TiddlyWiki/TiddlyWikiClassic/issues/308; but may be I'll propose a Timimi update as well

PengjuYan commented 8 months ago

Hi @YakovL , thought you guys have a lot of things to do. Just to remind and hope you put it on the agenda. Never mind and take your time. :-)