Closed Bug 790341 Opened 12 years ago Closed 12 years ago

/delayed command loses execution context for command

Categories

(Other Applications :: ChatZilla, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla-mozilla-20000923, Assigned: dsarratt)

Details

(Whiteboard: [cz-0.9.90])

Attachments

(1 file, 1 obsolete file)

When a command is executed, it has a context (stored in "e"), which contains the sourceObject and related data about where it was run. Many commands operate on this. The /delayed command does not preserve this when executing its delayed command argument, meaning that the current view is used instead of the one the /delayed command was executed on. This can be especially bad for auto-perform /delayed commands.
Passing the context to the dispatch() call seems to fix this, for both auto-performed and manually-entered delays. I don't think there's a situation where the context could be deleted between the cmdDelayed() call and the dispatch() call, but if it does get deleted we just have a reversion to previous behaviour (using the current view).
Assignee: silver → dsarratt
Status: NEW → ASSIGNED
Attachment #687468 - Flags: review?
Comment on attachment 687468 [details] [diff] [review]
Make delayed commands execute in the proper view.

Review of attachment 687468 [details] [diff] [review]:
-----------------------------------------------------------------

Happy with this patch if either modification I suggest resolves the issue I believe exists (or you can show the issue doesn't exist).

::: xul/content/commands.js
@@ +1113,4 @@
>  {
>      function _dispatch()
>      {
> +        dispatch(e.rest, e, e.isInteractive);

I believe we need to delete e.inputData before this call, otherwise if you delay an unknown command with no arguments it messes up and sends "/quote command delay command" (i.e. appends the /delayed arguments).

(We could also fix that in dispatch() itself, where it sets e.inputData to ary[2] on line 349, by adding an else which sets it to "".)
Attachment #687468 - Flags: review? → review+
That bug you mentioned applies to any command with no arguments (e.g. "/delayed 5 leave" will attempt to leave a channel called 5 if run outside a channel view). I wasn't able to track down what's causing this, but the fix you mentioned does work.
Attachment #687468 - Attachment is obsolete: true
Attachment #692552 - Flags: review?
Comment on attachment 692552 [details] [diff] [review]
Fix for bug 790341

Review of attachment 692552 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!

The problem was that after splitting command and arguments at http://hg.mozilla.org/chatzilla/file/aef5fb39a211/xul/content/commands.js#l339 we only set e.inputData if it was split, not when it is just a command (which is what we have in this patch).
Attachment #692552 - Flags: review? → review+
http://hg.mozilla.org/chatzilla/rev/c0e8aca3cf41
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [cz-0.9.90]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: