Prompt doesn't work in 2.11

0 views
Skip to first unread message

shortfuse

unread,
Jun 10, 2010, 5:38:04 PM6/10/10
to Music Player Minion
Recently installed MPM 2.11. I was using 2.0 and had added a few
things to the right-click menu for the playlist using the menu
editor. With 2.11 it seems that prompt() no longer works.

Example code to move a song to a new position in the playlist:

var newPos=prompt("Enter New Playlist Position:");
newPos=newPos-1;
if(newPos >= 0 ) mpd.doCmd("move "+item.Pos+" "+newPos)


This code worked in 2.0 but I don't ever get a prompt in 2.11.

Has something changed?

Aurélien Requiem

unread,
Jun 10, 2010, 5:49:35 PM6/10/10
to music-pla...@googlegroups.com
Hi shortfuse,

Yes you're right things have changed. Since 2.1 and to meet mozilla requirements, I had to remove all the eval() from the code and put most of them in evalInSandbox(). The call to this new function explicitly prevent such functions.
Since 2.1.2, this menu was removed to prevent confusion. Though I will try to re-enable such function in a future release.

Last point, if you used this menu to add urls, in 2.1.2, I've added support to playlist and streaming via the "save as..." window. This should ease the process to add specific url.

Thanks



--
You received this message because you are subscribed to the Google Groups "Music Player Minion" group.
To post to this group, send email to music-pla...@googlegroups.com.
To unsubscribe from this group, send email to music-player-mi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/music-player-minion?hl=en.


Chris Seickel

unread,
Jun 11, 2010, 9:29:28 AM6/11/10
to music-pla...@googlegroups.com
I think just exposing the window's prompt and alert functions to the sandbox would be the best solution.  I can't think of any security problems resulting from the use of these two functions, and they are useful to many situations that a custom script would be written for.

At least it would be a quick solution and easily reversed if the AMO reviewer has an issue with it. 

Aurélien Requiem

unread,
Jun 11, 2010, 7:19:15 PM6/11/10
to music-pla...@googlegroups.com
Yes, you're right Chris.
I'll try do that probably during the weekend and see the result.

I'll let you know how things go...

Aurélien Requiem

unread,
Jun 12, 2010, 10:39:07 PM6/12/10
to music-pla...@googlegroups.com
Hi,

I had a look this Sunday to re assess if it's possible or not to display popup, alerts, prompts within the evalInSandbox() environment.
The result is what I've already noticed in the past. It is not possible (for what I know) to play with window and prompt functions. This triggers an exception and the sandbox is exited.
It tried various methods, but no success. The log generated by the exception :
12:23:32.745 message: Permission denied for <chrome://minion> to call method ChromeWindow.prompt on <>.
             fileName: chrome://minion/content/menus.js
             lineNumber: 153
             stack:
             name: Error

So far, I try to pass the function prompt(), the object window or to create a new service nsIPromptService. The error is the same "Permission denied".

In the futur, as the custom menu is a great feature to me, I may create a "menu" plugin for mpm but not hosted by AMO. Regular users will still have access to the menu, in a way that complies with AMO safety requirements. For advanced users who have installed the additional plugin, they will be able to have higher execution privileges and additional features. they will be able to use the eval() and have more controls on their scripts.

The delivery will be done in issue 89 so everyone can track the changes :
http://code.google.com/p/musicpm/issues/detail?id=89

Once this will be created, it might be possible to propose user's scripts to perform various actions. User's submitted script will be reviewed by the community and then published.

Any ideas, comment, suggestions are welcome.
Reply all
Reply to author
Forward
0 new messages