Just a quickie for all of those willing to download this new version: there is a slight error in the download link.
It should start with "classic" instead of "www" in the "download now..." link on http://classic.tiddlywiki.com/beta
The correct link is : http://classic.tiddlywiki.com/beta/empty.zip
I tried on a different computer as well, this time with Java 7.63 (the other had earlier versions). The Java prompt issue in Safari persisted, but not the double-quote issue. The double-quote issue also disappeared in Waterfox, but not in IE (64-bit, btw). I also tested in Chrome, which doesn't seem to be affected. Also, not just empty values in the Tweak menu contain quotes, other values have them as well, except for some reason txtUserName.
chkSomeThing:"true" chkSomeThingElse:"false" txtSomeText:"gleep" txtSomeEmptyText:""config.options["chkEncodeCookieQuotes"]=true;Hi Eric,
thank you for this update! I'm glad to see that TWC development doesn't stop at all. I will test and report as soon as possible.
Regards,
Albert
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
Confirming fixes:112 & 154: fixed, works, will close the issue (154) shortly
157: fixed, doesn't need testing, will close the issue shortly160: fixed, doesn't need testing, will close the issue shortly162: fixed, works, will close the issue shortly
161: fixed, works, will close the issue shortly
159: fixed, works; is it really necessary to surrond all the values with %22...%22? Even one-word, like true/false or numbers, like txtMaxEditRows:30? (it would ease migrating)
As far as I can see (from [1-3]), that would work as expected in both versions of cookie-handling.
However, once TW5 is out of beta, my primary focus will shift to creating and publishing a TW5 version of TiddlyTools and developing new plugins for TiddlyWiki5, as well as writing TiddlyWiki5 documentation (perhaps an actual book?!?) and providing user support for the "migration path" from TiddlyWiki Classic to TiddlyWiki5 (i.e., guidelines and scripts for converting existing documents).
159: fixed, works; is it really necessary to surrond all the values with %22...%22? Even one-word, like true/false or numbers, like txtMaxEditRows:30? (it would ease migrating)
As far as I can see (from [1-3]), that would work as expected in both versions of cookie-handling.
name1:"value1" name2:"value2" name3:"value3"config.options.chkEncodeCookieQuotes=true;I have a major problem though: I failed to save the new TW using TiddlySaver in these 4 combinations:
Windows 7 x64 + Opera 12.17 +
either my PC with old Java (as far as I can see 7 update 17) or another PC with the latest (7 update i-don't-remember-which) +
either old TiddlySaver I still use or the new one in the package.
On trying to save, the console sais:
javaLoadFile: TypeError: 'applet.loadFile' is not a function
javaSaveFile: TypeError: 'applet.saveFile' is not a function
javaDebugInformation() gives:
"Java Version: TypeError: Cannot convert 'method' to object
Last Exception: TypeError: Cannot convert 'method' to object
Last Exception Stack Trace: TypeError: Cannot convert 'method' to object
System Properties: TypeError: Cannot convert 'method' to object"and that's in each case, including the fresh installation on the other PC.
Eric,
just my two cents here: personally, I'm heavily interested in better understanding the architecture of TW5 and how to customize and extend it. Some topics I could imagine...
On Friday, August 29, 2014 11:55:40 AM UTC-7, Yakov wrote:159: fixed, works; is it really necessary to surrond all the values with %22...%22? Even one-word, like true/false or numbers, like txtMaxEditRows:30? (it would ease migrating)
As far as I can see (from [1-3]), that would work as expected in both versions of cookie-handling.Although many option values are single words, numbers, or true/false, option values *can* contain whitespace, so at least some of the time, there is a need for the surrounding quotes. However, a valid browser cookie should not contain any quotes, and cookies containing quotes are rejected by some (but not all) browsers. This is the basis for issue #159, which reported that Opera did not save the TiddlyWiki option values between sessions. Although I have not confirmed, I think that this error was also responsible for preventing options from being saved in other browsers as well.TWClassic uses String.encodeHashMap() [1] to construct a space-separated string of name/value pairs, where each option name is followed by a colon (:), and the option value is *always* enclosed in double-quotes, like this:name1:"value1" name2:"value2" name3:"value3"
The fix for #159 did not change the way the individual option values are encoded/decoded from the cookie text. Rather, it simply converts the *existing* use of quotes to %22 to avoid being rejected by the browser. Of course, since most option values are single-words, numbers, or true/false, we could reduce -- but not completely eliminate -- the use of quotes in the encoded cookie text, by changing String.encodeHashMap() to check for whitespace in the option values, and only adding the surrounding quotes when actually needed. The resulting cookie text would still need to have any quotes encoded as %22, so those option values could still be affected by the "version skew" issue that #whatever reported above.So.. I now have two possible improvements for the 159 fix:1) maintain backward-compatibility by adding a chkEncodeCookieQuotes option (default to false) to completely bypass the %22 encoding/decoding. This will allow continued use of a mixed version environment (i.e., TW2.8.1 or earlier running along side TW2.9.0) for browsers that DO accept cookie values containing quotes. Of course, because the cookie text would then contain quotes, browsers that DONT accept quotes will reject any changes to default option settings; thus, to enable the %22 encoding for those browsers, the TW author cannot simply "set an option checkbox" (as that setting would not be saved). Instead, they would need to explicitly add a systemConfig tiddler containing:config.options.chkEncodeCookieQuotes=true;
2) reduce (but not eliminate) the use of quotes in cookie text by checking for whitespace in String.encodeHashMap(). This limits the impact of the %22 encoding, so that MOST option values would be backward compatible unless they contain whitespace.My only concern about solution (2) is that String.encodeHashMap() is not only used to encode the option cookie text, but is also used in the TWCore for some handling of custom fields. A quick review of the code suggests that it would be "safe", but I prefer to keep changes as isolated as possible to minimize their any unexpected impact on existing TiddlyWiki uses.
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.javaSaveFile is actually called, the exception is applet.saveFile is not a function. applet = document.applets['TiddlySaver']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
1. In 2.7.1 and 2.9.0javaSaveFilehas 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",javaSaveFileis actually called, the exception is applet.saveFile is not a function. applet = document.applets['TiddlySaver']
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"/>
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"/>]
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.
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..
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.
javaSaveFile = function(filePath,content)
{
var applet = document.applets['TiddlySaver'];
if(applet instanceof HTMLCollection) // YL tweak
applet = applet.item(0);
try {
if (applet && filePath) {
return applet.saveFile(javaUrlToFilename(filePath), "UTF-8", content);
}
} catch(ex) {
logTiddlySaverException("javaSaveFile", ex);
}
// is this next block working anywhere ? -- grmble
try {
var s = new java.io.PrintStream(new java.io.FileOutputStream(javaUrlToFilename(filePath)));
s.print(content);
s.close();
} catch(ex2) {
return null;
}
return true;
}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.
So,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.By the way, with the old TiddlySaver, this bad-semantics fixer plugin enables saving:javaSaveFile = function(filePath,content) { var applet = document.applets['TiddlySaver']; if(applet instanceof HTMLCollection) // YL tweak applet = applet.item(0); try {
2) in Opera, examine the value of document.documentElement.outerHTML, and see what <applet>...</applet> block(s) it contains.
There's 2 applet blocks. After the definition of the TW21Saver.prototype.externalizeTiddler method, there's this part:
...
then some deprecated code and some other goes (which is not repeated), and in the end of the text:
...
$.twStylesheet.remove = function(options) {
...
})(jQuery);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
if(useJavaSaver)
document.write("<applet style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class' archive='TiddlySaver.jar' width='1' height='1'></applet>");
//]]>
</script><applet style="position:absolute;left:-1px" name="TiddlySaver" code="TiddlySaver.class" archive="TiddlySaver.jar" width="1" height="1"></applet>
Then, use the browser's debugger to invoke manually recreateOriginal() and see if the returned value contains any "extra" <applet>...</applet> blocks.No applet blocks in the returned value.
I suspect that if you simply remove the first occurrence of the if(userJavaSaver) code from that document, the problem would go away.
Of course, even if this does fix it, it doesn't explain how two instances of that code got in the file in the first place. The problem MIGHT be 'historical', in that the problem was only with a specific revision, and it won't re-occur as long as you are no longer using that version (or hand edit the file as suggested above). Still, it would be useful to figure out exactly how and when the problem was first introduced, so it can be documented for others who may encounter it.
Aha. The source of 2.9.0 beta 1 contains two of these blocks:
<script type="text/javascript">
//<![CDATA[
if(useJavaSaver)
document.write("<applet style='position:absolute;left:-1px' name='TiddlySaver' code='TiddlySaver.class' archive='TiddlySaver.jar' width='1' height='1'></applet>");
//]]>
</script>
And yes, removing the first one from the source code fixes the issue (for the old saver, I have to test the new saver separately, as on my PC the old Java version is installed). Moreover, my "redefine the applet variable" fix doesn't work with SaveAsPlugin, while this does.
Of course, even if this does fix it, it doesn't explain how two instances of that code got in the file in the first place. The problem MIGHT be 'historical', in that the problem was only with a specific revision, and it won't re-occur as long as you are no longer using that version (or hand edit the file as suggested above). Still, it would be useful to figure out exactly how and when the problem was first introduced, so it can be documented for others who may encounter it.
Well, I have almost no idea how TWc is cooked, so I would hardly help here unless given some introduction.
TWC 2.9.0 beta3 has been published without notice on November 3rd according to
http://classic.tiddlywiki.com/beta
Any hint for the 2.9.0 official release?