Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/sjcl variable #8099

Merged
merged 5 commits into from
May 26, 2024
Merged

Fix/sjcl variable #8099

merged 5 commits into from
May 26, 2024

Conversation

linonetwo
Copy link
Contributor

@linonetwo linonetwo commented Mar 21, 2024

#8043 (comment) does not fix my problem, I get error Can't create duplicate variable: 'A' on iOS webview on TidGi mobile when init TW.

And I find sjcl.js 's internal this.A=xxx leak to window, where this is window. And later it does function A(){xxx}, and cause error on iOS. See this on tw5-com

图片

In this PR I wrap IIFE to sjcl.js by using tiddlywiki.files. (I have to move sjcl.js to /lib, otherwise tiddlywiki.files will prevent boot.js from loading, don't know why.)

I also change sha256 to use $tw.sjcl, but this is not necessary, because we have to mount sjcl to window.sjcl before booting, when $tw is not init yet. Unless we can init $tw = {} before library.

Copy link

vercel bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview May 25, 2024 4:19am

@flibbles
Copy link
Contributor

@linonetwo, I've committed a programmer sin; I just opened a PR for this fix without checking that anyone else already had. I just assumed that nobody else would have noticed this problem than me, the Uglify maker.

I actually think your fix is better, so I'll close my PR and vouch for yours.

@Jermolene
Copy link
Owner

Thanks @linonetwo I think it would be better for backwards compatibility to move sjcl.js back into /boot. To avoid the problem you ran into we just need to explicitly list boot.css, boot.js and bootprefix.js in tiddlywiki.files

@linonetwo
Copy link
Contributor Author

I was about to write tiddlywiki galgame plugin today, but I think about it, if this PR only takes 5 min to refactor, then I should tend to this.

@Jermolene
Copy link
Owner

Thanks @linonetwo much appreciated

@Jermolene Jermolene merged commit a463783 into Jermolene:master May 26, 2024
4 checks passed
@pmario
Copy link
Contributor

pmario commented May 27, 2024

@Jermolene -- This PR breaks the RSOD popup.

I did test the following code with the latest master and it broke the popup See: screenshot

\define re() (color)|(colour)ed

\define str() Something coloured

{{{ [<str>splitregexp<re>] }}}

image

@linonetwo
Copy link
Contributor Author

截屏2024-05-27 18 15 47

Looks like some core css (.tc-error-form) is missing, maybe is caused by tiddlywiki.files added in last commit

@linonetwo
Copy link
Contributor Author

I forget to add style system tag to it, let me PR a quick fix.

@linonetwo linonetwo mentioned this pull request May 27, 2024
Jermolene pushed a commit that referenced this pull request May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants