On Monday, September 8, 2014 10:36:16 AM UTC-7, Yakov wrote:
>
> Trying to make TW 2.9.0 save in Opera 12.17, I started to trace what's 
> going on and here what I've found:
>
> 0. TW that I'm currently using is 2.7.1, so I'm not sure yet if the 
> problem arised in 2.9.0 or in 2.8.0/2.8.1
>

I suspect it might actually be a problem with the fallback "download save" 
handler from 2.8.x.
If TiddlySaver.jar failed to load in 2.8.x, then the fallback handler has 
to reconstruct the original source file from the contents of the loaded 
document, rather than reading it from the filesystem.

Unfortunately, the document image from the loaded document 
(document.documentElement.outerHTML) is *not* identical to the original 
file content (though it is very close).  One of the differences is that, 
during startup, the TWCore uses document.write() to conditionally *add* the 
"<applet>...</applet>" code to the HTML, but only when the "useJavaSaver" 
flag is set (which it *is* for Opera).  To address this, the 
recreateOriginal() function, invoked by the fallback handler, 'fixes up' 
the document image by *removing* the applet element that was added during 
startup.

It's possible that when using Opera with 2.8.x, a failed attempt was made 
to load TiddlySaver.jar (perhaps due to one of the Java runtime updates 
that broke the signed/unsigned use of privileged file I/O functions... now 
corrected by PVHL's update).  This failure to load TiddlySaver.jar would 
then trigger the fallback handling, which in turn would invoke 
recreateOriginal().  However, if the "remove the added applet" code didn't 
work for some reason (perhaps it didn't *exactly* match the embedded applet 
syntax generated by Opera?), then the file would be written using the 
fallback handler with the <applet>...</applet> intact, and the next time 
the file was loaded, *another* <applet>...</applet> block would be added, 
resulting in the applet being loaded twice... and I suppose that could 
cause it to fail, even with the new, 'fixed' TiddlySaver.jar.

1. In 2.7.1 and 2.9.0 javaSaveFile has the same code. I decided to test TW 
> 2.9.0 with the old TiddlySaver which works for me with TW 2.7.1.
> 2. When I press "save changes", javaSaveFile is actually called, the 
> exception is applet.saveFile is not a function. applet = 
> document.applets['TiddlySaver']
>

This suggests that the JavaSaver.jar failed to load properly.  Thus, while 
the loaded applet object exists, the saveFile method might still be 
undefined, resulting in the error you see.
 

> 3. In TW 2.7.1 (and old TiddlySaver), if I write in console
> document.applets['TiddlySaver']
> I get
> <applet style="position:absolute;left:-1px" name="TiddlySaver" 
> code="TiddlySaver.class" archive="TiddlySaver.jar" width="1" height="1"/>
>

That looks correct.
 

>
> In TW 2.9.0 (and old TiddlySaver), I get (!)
> HTMLCollection [<applet style="position:absolute;left:-1px" 
> name="TiddlySaver" code="TiddlySaver.class" archive="TiddlySaver.jar" 
> width="1" height="1"/>, <applet style="position:absolute;left:-1px" 
> name="TiddlySaver" code="TiddlySaver.class" archive="TiddlySaver.jar" 
> width="1" height="1"/>]
>

Uh oh.. that's not right.  The value of document.applets['TiddlySaver'] returns 
an HTMLCollection with two applets, rather than just one.  It looks like 
there are TWO "TiddlySaver" applets loaded at the same time, which would be 
a likely side-effect of the potential problem with recreateOriginal() that 
I described above.

At the same time, if I do this in Chrome, I get
> <applet style="position:absolute;left:-1px" name="TiddlySaver" 
> code="TiddlySaver.class" archive="TiddlySaver.jar" width="1" height="1"/>
> in both cases.
>

That's correct.
 

> Also, the same thing (HTMLCollection) appears instead of the applet in 
> Opera with the new TiddlySaver. So, this is the reason why saving doesn't 
> work..
>

Not surprising... if the problem is the errant doubling of the 
<applet>..</applet> block, then the problem will appear regardless of the 
version of TiddlySaver.jar you attempt.

Some things to try:
1) One way to look for confirmation of the problem, search the entire TW 
document source using a full-text editor, to see if a hard-coded 
<applet>...</applet> block exists (other than the conditional one present 
in the document.write()).  If such a block is found... try removing it from 
the document and then repeat your experiments to see if that fixes the 
problem.

2) in Opera, examine the value of document.documentElement.outerHTML, and 
see what <applet>...</applet> block(s) it contains.  Then, use the 
browser's debugger to invoke manually recreateOriginal() and see if the 
returned value contains any "extra" <applet>...</applet> blocks.

Let me know what you find out.  I'd like to post an updated Beta2 as soon 
as possible, but only after we solve this problem, or at least properly 
understand what is happening.

Much thanks,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to