Commit 4179bab7 authored by hyatt%netscape.com's avatar hyatt%netscape.com
Browse files

Checking in a patch for Antoine Labour, Open Link in New Tab, r=bryner, sr=hyatt, bug #101487

parent 3fd6b28d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -49,6 +49,10 @@
                label="&openLinkCmd.label;"
                accesskey="&openLinkCmd.accesskey;"
                oncommand="gContextMenu.openLink();"/>
		<menuitem id="context-openlinkintab"
                label="&openLinkCmdInTab.label;"
                accesskey="&openLinkCmdInTab.accesskey;"
                oncommand="gContextMenu.openLinkInTab();"/>
      <!-- XXX - DEPENDENT ON PRESENCE OF EDITOR!! - XXX -->
      <menuitem id="context-editlink"
                label="&editLinkCmd.label;"
+17 −0
Original line number Diff line number Diff line
@@ -76,6 +76,23 @@
    newWin.saveFileAndPos = true;
  }

  function openNewTabWith(url) {

	urlSecurityCheck(url, document);
    var wintype = document.firstChild.getAttribute('windowtype');

    // if and only if the current window is a browser window and it has a document with a character
    // set, then extract the current charset menu setting from the current document and use it to
    // initialize the new browser window...
    if (window && (wintype == "navigator:browser")) {
		var browser=getBrowser();
		browser.selectedTab = browser.addTab(url);
    }
 
    // Fix new window.    
    newWin.saveFileAndPos = true;
  }

  function savePage(url) 
  {
    var postData = null; // No post data, usually.
+6 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ nsContextMenu.prototype = {
    initOpenItems : function () {
        // Remove open/edit link if not applicable.
        this.showItem( "context-openlink", this.onSaveableLink || ( this.inDirList && this.onLink ) );
        this.showItem( "context-openlinkintab", this.onSaveableLink || ( this.inDirList && this.onLink ) );
        this.showItem( "context-editlink", this.onSaveableLink && !this.inDirList );

        // Remove open frame if not applicable.
@@ -427,6 +428,11 @@ nsContextMenu.prototype = {
        // Determine linked-to URL.
        openNewWindowWith( this.linkURL() );
    },
    // Open linked-to URL in a new tab.
    openLinkInTab : function () {
        // Determine linked-to URL.
        openNewTabWith( this.linkURL() );
    },
    // Edit linked-to URL in a new window.
    editLink : function () {
        urlSecurityCheck( this.linkURL(), window.document );
+3 −1
Original line number Diff line number Diff line
<!-- Context Menu -->
<!ENTITY openLinkCmd.label            "Open in New Window">
<!ENTITY openLinkCmd.accesskey        "o">
<!ENTITY openLinkCmdInTab.label       "Open in New Tab">
<!ENTITY openLinkCmdInTab.accesskey   "t">
<!ENTITY openLinkInWindowCmd.label    "Open">
<!ENTITY openLinkInWindowCmd.accesskey "p">
<!ENTITY editLinkCmd.label            "Edit Link in Composer">