Ticket #1035 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

evaluated macro parameters are computed twice

Reported by: FND Owned by: FND
Priority: major Milestone: 2.6
Component: core Version:
Severity: medium Keywords:
Cc:

Description (last modified by FND) (diff)

As explained  here, some macros' use of parseParams causes evaluated macro parameters to be computed twice:

invokeMacro calls the respective macro's handler while passing params.readMacroParams():
 http://trac.tiddlywiki.org/browser/Trunk/core/js/main.js?rev=9473#L233
This in turn calls parseParams, which then computes evaluated parameters:
 http://trac.tiddlywiki.org/browser/Trunk/core/js/Strings.js?rev=9473#L187

However, some macros - like tiddler - also call parseParams, which leads to evaluated parameters being computed twice in those cases.

Thus fixing this issue might be as simple as relying on parseParams's allowEval argument, setting it to false in macro handlers. (That, of course, would require plugin authors to be aware of this somewhat obscure issue.)

Test case:

<<tiddler {{alert(new Date()); ""}}>>

Change History

Changed 4 years ago by FND

  • owner changed from JeremyRuston to MartinBudden
  • description modified (diff)

Changed 4 years ago by MartinBudden

  • milestone changed from 2.5.1 to 2.5.2

Changed 4 years ago by FND

  • owner changed from MartinBudden to FND

It appears this is not fixable without changing behavior and thus breaking backwards compatibility.

Changed 4 years ago by FND

  • status changed from new to closed
  • resolution set to wontfix

Changing this in the invokeMacro framework would break backwards compatibility.

Similarly, changing each individual macro's parseParams call to suppress evaluation would make the code counterintuitive (suggesting evaluated parameters are unsupported) and may also have unexpected side effects.

Thus wontfix due to backwards compatibility concerns.

Changed 4 years ago by MartinBudden

  • status changed from closed to reopened
  • resolution wontfix deleted
  • milestone changed from 2.5.3 to 2.2.6

Changed 3 years ago by MartinBudden

  • milestone changed from 2.2.6 to 2.6

Changed 3 years ago by MartinBudden

  • status changed from reopened to closed
  • resolution set to fixed

Fixed in changeset:11296

Note: See TracTickets for help on using tickets.