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

GM_openInTab() should obey Firefox tab options #1003

Closed
arantius opened this issue Aug 11, 2009 · 15 comments
Closed

GM_openInTab() should obey Firefox tab options #1003

arantius opened this issue Aug 11, 2009 · 15 comments

Comments

@arantius
Copy link
Collaborator

Originally: DevjaVu ticket 22

Firefox options allow the user to select whether new tabs open "in the background" or are immediately selected, when created (browser.tabs.loadInBackground). GM_openInTab() should obey this setting by default. Optionally, a second parameter could be added to allow the scriptwright to choose a particular behavior.

It would be a change in behavior, but it may be appropriate at this time to also add the Referer header. This has been requested, and would make GM_openInTab() act more like a regular window.open() or new tab navigation created by the user.

@arantius
Copy link
Collaborator Author

It's probably best to make use of openNewTabWith(). It would appear to satisfy the goals above, and do so with the same code, and thus same sort of activity, that the browser normally does.

@arantius
Copy link
Collaborator Author

See also: DevjaVu ticket 150

I'm writing a script (or trying to, really) that would fix some broken website behavior, making middle click open new tabs like I expect, for javascript "links". I'm currently running into popup-blocker issues.

I investigated GM_openInTab() but it provides neither the option to name the window (a'la window.open()) nor the window object as a return value for using. I can see no particular reason for this, and either or both would appear to only be a benefit.

@arantius
Copy link
Collaborator Author

So far I've got code that

  1. Does respect the loadInBackground behavior.
  2. Does not provide a mechanism to override it (above happens inside a core Mozilla function).
  3. Does return the new window handle.
  4. Does not allow said window to be closed -- it doesn't have the magic "was opened by script" flag, and I'm not sure how to get that.

@arantius
Copy link
Collaborator Author

Integrated into official tree.

@ocornu
Copy link
Contributor

ocornu commented Sep 12, 2009

I posted a comment on this commit.
Just mentioning it here in case, like myself, you tend to miss new github comments (how i wish github notified me by mail when new comments are posted).

@arantius
Copy link
Collaborator Author

Yeah. Comment on tickets, not commits. That seems to be the right thing to do.

I'm not sure about the question there. It would be good to test in older FFs.

@ocornu
Copy link
Contributor

ocornu commented Sep 12, 2009

Thought you were testing all patches against just about every FF version ever made. Glad to see you're human after all... ;-)

@Martii
Copy link
Contributor

Martii commented Sep 14, 2009

Comments on commits show up on the dashboard, however I usually try to focus around the tickets since they email... depends on if one uses the dashboards RSS feed (perhaps with a feed reader that supports emailing too) though and if following/watching an author. I have to test a few things in older FF's now, so I'll add this test to my list.

As I stated they should be functionally equivalent for the beginning parameters at a first, quick glance... href is aURL, etc... but I'll see if they function the same shortly.

EDIT:
Being constructive here... using this as the only line in a user.js:

GM_openInTab("http://www.yahoo.com");

and a clean profile with unedited 0.8.20090826.2 RC1 in:

  PASS   Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5

  PASS   Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9) Gecko/2008052912 Firefox/3.0

  FAIL   Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

Error: 
Source File: file:///home/{username}/.mozilla/firefox/{seed}.default/gm_scripts/{scriptname}/{scriptname}.user.js
Line: 0

  FAIL   Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8) Gecko/20051111 Firefox/1.5

Error: Component returned failure code: 0x804b000a [nsIIOService.newURI]
Source File: file:///home/{username}/.mozilla/firefox/{seed}.default/gm_scripts/{scriptname}/{scriptname}.user.js
Line: 364

Recommend reopening the ticket and "back to the drawing board"? :

Reference: commit

@avindra
Copy link

avindra commented Sep 14, 2009

Psssh..... drop support for suckers still using old builds of Firefox. There's no good reason for not upgrading.

@arantius
Copy link
Collaborator Author

In light of this, I vote to drop Firefox 1.5 support. It's under one quarter of one percent of our user base, and of course 0.8.1 is available forever, for those few users.

Johan?

@Martii
Copy link
Contributor

Martii commented Sep 16, 2009

I bolded the Firefox versions... hope this makes it easier to see which ones failed... like FF 2.0 failed too... I'm still honing markup skills here on github, so I appreciate everyones patience.

@arantius
Copy link
Collaborator Author

Whoops! Reading fail on my part. Looks like we'll need to detect FF version and pass parameters conditionally.

@arantius
Copy link
Collaborator Author

Pass the proper arguments for various FF versions.

Detect which version of firefox we are running in, and pass the proper
arguments to openNewTabWith(), as it changed across version 2 and 3.

Closed by 8cd7382

@Martii
Copy link
Contributor

Martii commented Sep 28, 2009

@arantius or Johan,

Can one of you give a quick sample at how the return value is supposed to be used... I'll dig in the commit tomorrow, however whenever I use evaluate or getElementsByTagName on its context it returns at least one error:

Error: Permission denied for <http://www.example.com> to get property Window.document from <moz-safe-about:blank>.
Source File: file:///home/{username}/.mozilla/firefox/{seed}.default/gm_scripts/{scriptName}/{scriptName}.user.js
Line: {lineNumberIn_scriptName}
Does open in new tabs correctly via Moz pref setting so far.

Thanks.

Using a clean profile in Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 with Greasemonkey 0.8.20090920.2 from AMO.

@arantius
Copy link
Collaborator Author

I'll admit I didn't do much of anything besides check that the return was a "window" object. It doesn't actually seem to be very useful at all.

This issue was closed.
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