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

Dropping a .user.js onto the new script manager fails to trigger installation #1142

Closed
qufighter opened this issue May 31, 2010 · 13 comments
Closed
Milestone

Comments

@qufighter
Copy link
Contributor

In examining the new userscript manager drag and drop features I realized it should probably behave as the extensions tab of the manager, where dropping an extension onto the list triggers install of that extension, ideally the same can be true for userscripts, and ideally the script installs and script execution order reflects the location that it was dropped onto the list.

I started work on this issue, validating file is user.js and getting the URL to file when one is dropped on the Userscript List in Addon Manager.

http://github.com/qufighter/greasemonkey/compare/master...issue_1142

@arantius
Copy link
Collaborator

arantius commented Jul 4, 2010

I've taken that and added a bit to make it functional. Based on the way ScriptDownloader works, the install dialog is attached to the browser window, not the addons window. But that's probably good enough for now.

http://github.com/arantius/greasemonkey/compare/master...issue_1142

@arantius
Copy link
Collaborator

arantius commented Jul 4, 2010

Basic support for drag/drop user scripts on the addons window to install.

Closed by dd22c58

@qufighter
Copy link
Contributor Author

I'm not sure we can close this since it's not getting past the first line of GM_installUri.

@arantius
Copy link
Collaborator

arantius commented Jul 8, 2010

Indeed.

Error: Cc is not defined
Source File: chrome://greasemonkey/content/utils.js
Line: 376

Whoops!

@arantius
Copy link
Collaborator

arantius commented Jul 8, 2010

Well, correcting the Cc and Ci references, because this function is sometimes used outside the component where they're defined, is easy.

But now, I'm seeing tons of crazy bugs. Perhaps a Linux thing, I didn't first develop this on Linux, but that's where I am now. I've pushed the easy fix, so it should show up in the next nightly. Then I'll have to dig into these bugs.

@Ventero
Copy link
Contributor

Ventero commented Jul 15, 2010

I can confirm the weird behavior you noticed under Linux.
I slightly modified urlFromDragEvent (see below) so it doesn't throw an exception when mozGetData no file, and it appears like everything works fine as long as I hover the file over the tab.
But as soon as I drop the file, FF throws Gtk-CRITICAL **: gtk_drag_get_data: assertion `GTK_IS_WIDGET (widget)' failed, file instanceof Components.interfaces.nsIFile returns false and instead file is just a string of UTF-8 characters or null.
Though this bug isn't 100% reproducible - sometimes FF doesn't throw that Gtk-exception, and then installing the script by dropping it works just fine.
So it looks like this weird behavior is actually a bug in Firefox itself.

The relevant part I changed in urlFromDragEvent:

var file = event.dataTransfer
    .mozGetDataAt('application/x-moz-file', 0);
if (file instanceof Components.interfaces.nsIFile) {
  url = GM_getUriFromFile(file).spec;
}

@arantius
Copy link
Collaborator

Reimplement with nsDragAndDrop, which works cross platform.

Closed by 98d0b3b

@qufighter
Copy link
Contributor Author

Is it known that feature issue is no longer working in master (drop script from filesystem anywhere, ff3.6)

Error: uncaught exception: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://greasemonkey/content/scriptdownloader.js :: anonymous :: line 74" data: no]

@arantius
Copy link
Collaborator

What is easily accessible now to test, Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0 works fine.

Could you provide an exact user-agent string like this where you're seeing failure?

@qufighter
Copy link
Contributor Author

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 with the old addons manager, maybe it's just the build I'm using. Dropping a script on the userscripts tab of the addons manager, clicking the install button does not dismiss the dialog, clicking it twice removes the script, and sometimes even though the script sometimes gets into the addons list, it will not stay there after restart.

  1.  Cu.import("resource://greasemonkey/GM_notification.js", tools);
    

@arantius arantius reopened this Jul 23, 2011
@arantius
Copy link
Collaborator

K. This bug was the new manager, and in 0.9.0. For the old one: #1381

qufighter pushed a commit to qufighter/greasemonkey that referenced this issue Jul 23, 2011
@qufighter
Copy link
Contributor Author

Dropping a script on the userscript tab of the addon manager of FF5 results in "this addon could not be installed because it appears to be corrupt"

@hanjos
Copy link

hanjos commented Sep 27, 2011

Same problem here.

Photodeus pushed a commit to Photodeus/greasemonkey that referenced this issue Nov 22, 2012
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

No branches or pull requests

4 participants