From 6805e63b384d122817e89af7116fc2e526e8904d Mon Sep 17 00:00:00 2001 From: "disttsc%bart.nl" Date: Mon, 8 Jan 2001 02:19:35 +0000 Subject: [PATCH] Fix callers of old BrowserLoadURL() to directly use loadShortcutOrURI(aURL). bug=61808, r=blake, a=ben git-svn-id: svn://10.0.0.236/trunk@84547 18797224-902f-48f8-a5cc-f745e15eee43 --- .../resources/content/sessionHistoryUI.js | 93 ++++++++----------- .../resources/content/contentAreaClick.js | 11 +-- .../resources/content/contentAreaDD.js | 4 +- 3 files changed, 46 insertions(+), 62 deletions(-) diff --git a/mozilla/xpfe/browser/resources/content/sessionHistoryUI.js b/mozilla/xpfe/browser/resources/content/sessionHistoryUI.js index 9fc96c94fc6..f1f49e1d362 100644 --- a/mozilla/xpfe/browser/resources/content/sessionHistoryUI.js +++ b/mozilla/xpfe/browser/resources/content/sessionHistoryUI.js @@ -31,58 +31,48 @@ var rdfc = Components.classes["@mozilla.org/rdf/container-utils;1"] .getService(Components.interfaces.nsIRDFContainerUtils); var localstore = rdf.GetDataSource("rdf:localstore"); -function FillHistoryMenu( aParent, aMenu ) +function FillHistoryMenu(aParent, aMenu) { - // Get the content area docshell - var browserElement = document.getElementById("content"); - if (browserElement) - { - var webNavigation = browserElement.webNavigation; - if (webNavigation) - { - var shistory = webNavigation.sessionHistory; - if (shistory) - { - //Remove old entries if any - deleteHistoryItems( aParent ); - var count = shistory.count; - var index = shistory.index; - var end; - var j; - var entry; + // Remove old entries if any + deleteHistoryItems(aParent); - switch (aMenu) - { - case "back": - end = (index > MAX_HISTORY_MENU_ITEMS) ? index - MAX_HISTORY_MENU_ITEMS : 0; - for ( j = index - 1; j >= end; j--) - { - entry = shistory.getEntryAtIndex(j, false); - if (entry) - createMenuItem( aParent, j, entry.title ); - } - break; - case "forward": - end = ((count-index) > MAX_HISTORY_MENU_ITEMS) ? index + MAX_HISTORY_MENU_ITEMS : count; - for ( j = index + 1; j < end; j++) - { - entry = shistory.getEntryAtIndex(j, false); - if (entry) - createMenuItem( aParent, j, entry.title ); - } - break; - case "go": - end = count > MAX_HISTORY_MENU_ITEMS ? count - MAX_HISTORY_MENU_ITEMS : 0; - for( j = count - 1; j >= end; j-- ) - { - entry = shistory.getEntryAtIndex(j, false); - if (entry) - createCheckboxMenuItem( aParent, j, entry.title, j==index ); - } - break; - } - } - } + var sessionHistory = getWebNavigation().sessionHistory; + + var count = sessionHistory.count; + var index = sessionHistory.index; + var end; + var j; + var entry; + + switch (aMenu) + { + case "back": + end = (index > MAX_HISTORY_MENU_ITEMS) ? index - MAX_HISTORY_MENU_ITEMS : 0; + for (j = index - 1; j >= end; j--) + { + entry = sessionHistory.getEntryAtIndex(j, false); + if (entry) + createMenuItem(aParent, j, entry.title); + } + break; + case "forward": + end = ((count-index) > MAX_HISTORY_MENU_ITEMS) ? index + MAX_HISTORY_MENU_ITEMS : count; + for (j = index + 1; j < end; j++) + { + entry = sessionHistory.getEntryAtIndex(j, false); + if (entry) + createMenuItem(aParent, j, entry.title); + } + break; + case "go": + end = count > MAX_HISTORY_MENU_ITEMS ? count - MAX_HISTORY_MENU_ITEMS : 0; + for (j = count - 1; j >= end; j--) + { + entry = sessionHistory.getEntryAtIndex(j, false); + if (entry) + createCheckboxMenuItem(aParent, j, entry.title, j==index); + } + break; } } @@ -92,8 +82,7 @@ function executeUrlBarHistoryCommand( aTarget ) var value = aTarget.getAttribute("value"); if (index != "nothing_available" && value) { - gURLBar.value = value; - BrowserLoadURL(); + loadShortcutOrURI(value); } } diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js index bd5ee32595b..05a6fbdf422 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaClick.js +++ b/mozilla/xpfe/communicator/resources/content/contentAreaClick.js @@ -164,13 +164,10 @@ function middleMousePaste() { - var url = readFromClipboard(); - //dump ("Loading URL on clipboard: '" + url + "'; length = " + url.length + "\n"); - if (url) { - var urlBar = document.getElementById("urlbar"); - urlBar.value = url; - BrowserLoadURL(); - return true; + var url = readFromClipboard(); + if (url) { + loadShortcutOrURI(url); + return true; } return false; } diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaDD.js b/mozilla/xpfe/communicator/resources/content/contentAreaDD.js index 8d0a6053665..38b98e4deaf 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaDD.js +++ b/mozilla/xpfe/communicator/resources/content/contentAreaDD.js @@ -165,9 +165,7 @@ var contentAreaDNDObserver = { return true; switch (document.firstChild.getAttribute('windowtype')) { case "navigator:browser": - var urlBar = document.getElementById("urlbar"); - urlBar.value = url; - BrowserLoadURL(); + loadShortcutOrURI(url); break; case "navigator:view-source": viewSource(url);