diff --git a/mozilla/suite/browser/navigator.js b/mozilla/suite/browser/navigator.js index eb56e8fcbb7..2b1a5203962 100644 --- a/mozilla/suite/browser/navigator.js +++ b/mozilla/suite/browser/navigator.js @@ -21,6 +21,7 @@ var appCoreName = ""; var defaultStatus = "default status text"; var debugSecurity = false; // Set this true to enable Security chrome testing. + var explicitURL = false; function Startup() { @@ -37,6 +38,15 @@ } } + function Shutdown() { + // Close the app core. + if ( appCore ) { + appCore.close(); + // Remove app core from app core manager. + XPAppCoresManager.Remove( appCore ); + } + } + function onLoadWithArgs() { // See if Startup has been run. if ( appCore ) { @@ -50,59 +60,73 @@ } else { // onLoad handler timing is not correct yet. dump( "onLoadWithArgs not needed yet\n" ); + // Remember that we want this url. + explicitURL = true; } } function tryToSetContentWindow() { - if ( window.frames[0].frames[1] ) { + if ( window.content ) { dump("Setting content window\n"); - appCore.setContentWindow( window.frames[0].frames[1] ); + appCore.setContentWindow( window.content ); // Have browser app core load appropriate initial page. - var pref = Components.classes['component://netscape/preferences']; - - // if all else fails, use trusty "about:" as the start page - var startpage = "about:"; - if (pref) { - pref = pref.getService(); + if ( !explicitURL ) { + var pref = Components.classes['component://netscape/preferences']; + dump("Components = " + Components + "\n"); + dump("Components.classes = " + Components.classes + "\n"); + dump("Components.classes[component://netscape/preferences] = " + pref + "\n"); + + // if all else fails, use trusty "about:blank" as the start page + var startpage = "about:blank"; + if (pref) { + pref = pref.getService(); + } + else { + dump("failed to get component://netscape/preferences\n"); + } + if (pref) { + pref = pref.QueryInterface(Components.interfaces.nsIPref); + } + else { + dump("failed to get pref service\n"); + } + if (pref) { + // from mozilla/modules/libpref/src/init/all.js + // 0 = blank + // 1 = home (browser.startup.homepage) + // 2 = last + choice = pref.GetIntPref("browser.startup.page"); + dump("browser.startup.page = " + choice + "\n"); + switch (choice) { + case 0: + startpage = "about:blank"; + break; + case 1: + startpage = pref.CopyCharPref("browser.startup.homepage"); + break; + case 2: + var history = Components.classes['component://netscape/browser/global-history']; + if (history) { + history = history.getService(); + } + if (history) { + history = history.QueryInterface(Components.interfaces.nsIGlobalHistory); + } + if (history) { + startpage = history.GetLastPageVisted(); + } + break; + default: + startpage = "about:blank"; + } + } + else { + dump("failed to QI pref service\n"); + } + dump("startpage = " + startpage + "\n"); + document.getElementById("args").setAttribute("value", startpage); } - if (pref) { - pref = pref.QueryInterface(Components.interfaces.nsIPref); - } - if (pref) { - // from mozilla/modules/libpref/src/init/all.js - // 0 = blank - // 1 = home (browser.startup.homepage) - // 2 = last - // 3 = splash (browser.startup.splash) - choice = pref.GetIntPref("browser.startup.page"); - switch (choice) { - case 0: - startpage = "about:blank"; - break; - case 1: - startpage = pref.CopyCharPref("browser.startup.homepage"); - break; - case 2: - var history = Components.classes['component://netscape/browser/global-history']; - if (history) { - history = history.getService(); - } - if (history) { - history = history.QueryInterface(Components.interfaces.nsIGlobalHistory); - } - if (history) { - startpage = history.GetLastPageVisted(); - } - break; - case 3: - startpage = pref.CopyCharPref("browser.startup.splash"); - break; - default: - startpage = "about:"; - } - } - document.getElementById("args").setAttribute("value", startpage); appCore.loadInitialPage(); } else { // Try again. @@ -117,16 +141,17 @@ service += "?AlisSourceLang=" + src; service += "&AlisTargetLang=" + dest; service += "&AlisMTEngine=SSI"; - service += "&AlisTargetURI=" + window.frames[0].frames[1].location.href; - window.frames[0].frames[1].location.href = service; + service += "&AlisTargetURI=" + window.content.location.href; + window.content.location.href = service; } function RefreshUrlbar() { //Refresh the urlbar bar - document.getElementById('urlbar').value = window.frames[0].frames[1].location.href; + document.getElementById('urlbar').value = window.content.location.href; } + function BrowserBack() { // Get a handle to the back-button @@ -143,6 +168,7 @@ } } + function BrowserForward() { // Get a handle to the back-button @@ -159,20 +185,21 @@ } } + function BrowserSetForward() { var forwardBElem = document.getElementById("canGoForward"); if (!forwardBElem) { - dump("Couldn't obtain handle to forward Broarcast element\n"); - return; - } + dump("Couldn't obtain handle to forward Broarcast element\n"); + return; + } var canForward = forwardBElem.getAttribute("disabled"); var fb = document.getElementById("forward-button"); if (!fb) { - dump("Could not obtain handle to forward button\n"); - return; + dump("Could not obtain handle to forward button\n"); + return; } // Enable/Disable the Forward button @@ -195,10 +222,8 @@ fm.setAttribute("disabled", "true"); } else { - dump("Setting forward menu item enabled\n"); fm.setAttribute("disabled", ""); - } - + } } function BrowserCanStop() { @@ -213,6 +238,15 @@ stopButton.setAttribute( "disabled", "" ); } } + //Enable/disable the stop menu item + var stopMenu = document.getElementById( "menuitem-stop" ); + if ( stopMenu ) { + if ( stopDisabled == "true") { + stopMenu.setAttribute( "disabled", "true" ); + } else { + stopMenu.setAttribute( "disabled", "" ); + } + } } } @@ -222,14 +256,14 @@ if (!stopBElem) { dump("Couldn't obtain handle to stop Broadcast element\n"); return; - } + } var canStop = stopBElem.getAttribute("disabled"); var sb = document.getElementById("stop-button"); if (!sb) { - dump("Could not obtain handle to stop button\n"); - return; + dump("Could not obtain handle to stop button\n"); + return; } // If the stop button is currently disabled, just return @@ -262,16 +296,16 @@ { var backBElem = document.getElementById("canGoBack"); if (!backBElem) { - dump("Couldn't obtain handle to back Broadcast element\n"); - return; - } + dump("Couldn't obtain handle to back Broadcast element\n"); + return; + } var canBack = backBElem.getAttribute("disabled"); var bb = document.getElementById("back-button"); if (!bb) { - dump("Could not obtain handle to back button\n"); - return; + dump("Could not obtain handle to back button\n"); + return; } // Enable/Disable the Back button @@ -294,16 +328,85 @@ bm.setAttribute("disabled", "true"); } else { - dump("Setting Back menuitem to enabled\n"); bm.setAttribute("disabled", ""); - } - + } + } + + + function BrowserSetReload() { + var reload = document.getElementById("canReload"); + if ( reload ) { + var reloadDisabled = reload.getAttribute("disabled"); + //Enable/disable the reload button + var reloadButton = document.getElementById( "reload-button" ); + + if ( reloadButton ) { + if ( reloadDisabled == "true") { + reloadButton.setAttribute( "disabled", "true" ); + } else { + reloadButton.setAttribute( "disabled", "" ); + } + } + //Enable/disable the reload menu + var reloadMenu = document.getElementById("menuitem-reload"); + if ( reloadMenu ) { + if ( reloadDisabled == "true") { + + reloadMenu.setAttribute( "disabled", "true" ); + } else { + + reloadMenu.setAttribute( "disabled", "" ); + } + } + } + } + + function BrowserReallyReload(reloadType) { + // Get a handle to the "canReload" broadcast id + var reloadBElem = document.getElementById("canReload"); + if (!reloadBElem) { + dump("Couldn't obtain handle to reload Broadcast element\n"); + return; + } + + var canreload = reloadBElem.getAttribute("disabled"); + var sb = document.getElementById("reload-button"); + if (!sb) { + dump("Could not obtain handle to reload button\n"); + return; + } + + // If the reload button is currently disabled, just return + if ((sb.getAttribute("disabled")) == "true") { + return; + } + + //reload button has just been pressed. Disable it. + sb.setAttribute("disabled", "true"); + + // Get a handle to the reload menu item. + var sm = document.getElementById("menuitem-reload"); + if (!sm) { + dump("Couldn't obtain menu item reload\n"); + } else { + // Disable the reload menu-item. + + sm.setAttribute("disabled", "true"); + } + + //Call in to BrowserAppcore to reload the current loading + if (appCore != null) { + dump("Going to reload\n"); + appCore.reload(reloadType); + } else { + dump("BrowserAppCore has not been created!\n"); + } } function BrowserHome() { - window.frames[0].frames[1].home(); + window.content.home(); RefreshUrlbar(); } @@ -319,7 +422,7 @@ return false; } - window.frames[0].frames[1].location.href = url; + window.content.location.href = url; RefreshUrlbar(); } @@ -343,7 +446,7 @@ } } if ( core ) { - core.ShowWindowWithArgs( "chrome://editor/content", window, "chrome://editor/content/EditorInitPage.html" ); + core.ShowWindowWithArgs( "chrome://editor/content", window, "resource:/res/html/empty_doc.html" ); } else { dump("Error; can't create toolkitCore\n"); } @@ -391,12 +494,12 @@ } } if ( core ) { - //core.ShowWindowWithArgs( "chrome:/navigator/content/openLocation.xul", window, appCoreName ); + //core.ShowWindowWithArgs( "resource:/res/samples/openLocation.xul", window, appCoreName ); var name = appCoreName.replace( /\./, /\_/ ); // Note: Use width/height one less than actual so resizing occurs. // This bypasses bug whereby dialog contents don't appear // till the dialog is resized. - window.openDialog( "chrome:/navigator/chrome/openLocation.xul", name+"_openLocation", "chrome,width=419,height=189", appCoreName ); + window.openDialog( "chrome://navigator/content/openLocation.xul", name+"_openLocation", "chrome,width=419,height=189", appCoreName ); } else { dump("Error; can't create toolkitCore\n"); } @@ -490,7 +593,7 @@ { if (appCore != null) { appCore.SetDocumentCharset(aCharset); - window.frames[0].frames[1].location.reload(); + window.content.location.reload(); } else { dump("BrowserAppCore has not been created!\n"); } @@ -585,7 +688,7 @@ { if (appCore != null) { dump("Wallet Safe Fillin\n"); - appCore.walletPreview(window, window.frames[0].frames[1]); + appCore.walletPreview(window, window.content); } else { dump("BrowserAppCore has not been created!\n"); } @@ -606,7 +709,7 @@ { if (appCore != null) { dump("Wallet Quick Fillin\n"); - appCore.walletQuickFillin(window.frames[0].frames[1]); + appCore.walletQuickFillin(window.content); } else { dump("BrowserAppCore has not been created!\n"); } @@ -644,32 +747,12 @@ function OpenMessenger() { - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow("chrome://messenger/content/", - window); - } + window.open("chrome://messenger/content/", "_new", "chrome"); } function OpenAddressbook() { - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow("chrome://addressbook/content/", - window); - } + window.open("chrome://addressbook/content/", "_new", "chrome"); } function MsgNewMessage() @@ -682,8 +765,8 @@ } } if (toolkitCore) { - toolkitCore.ShowWindow("chrome://messengercompose/content/", - window); + // We need to use ShowWindowWithArgs because message compose depend on callback + toolkitCore.ShowWindowWithArgs("chrome://messengercompose/content/", window, ""); } } @@ -706,9 +789,9 @@ } } if (toolkitCore) { - var url = window.frames[0].frames[1].location; + var url = window.content.location; dump("Opening view of source for" + url + "\n"); - toolkitCore.ShowWindowWithArgs("chrome:/navigator/content/viewSource.xul", window, url); + toolkitCore.ShowWindowWithArgs("chrome://navigator/content/viewSource.xul", window, url); } } @@ -783,16 +866,17 @@ var meter = document.getElementById("Browser:LoadingProgress"); if ( throbber && meter ) { var busy = throbber.getAttribute("busy"); + var wasBusy = meter.getAttribute("mode") == "undetermined" ? "true" : "false"; if ( busy == "true" ) { - mode = "undetermined"; - if ( !startTime ) { - startTime = (new Date()).getTime(); - } - } else { - mode = "normal"; - } - meter.setAttribute("mode",mode); - if ( mode == "normal" ) { + if ( wasBusy == "false" ) { + // Remember when loading commenced. + startTime = (new Date()).getTime(); + // Turn progress meter on. + meter.setAttribute("mode","undetermined"); + } + // Update status bar. + } else if ( busy == "false" && wasBusy == "true" ) { + // Record page loading time. var status = document.getElementById("Browser:Status"); if ( status ) { var elapsed = ( (new Date()).getTime() - startTime ) / 1000; @@ -801,7 +885,8 @@ status.setAttribute("value",msg); defaultStatus = msg; } - startTime = 0; + // Turn progress meter off. + meter.setAttribute("mode","normal"); } } } diff --git a/mozilla/suite/browser/navigator.xul b/mozilla/suite/browser/navigator.xul index 2c0d37ebef3..c665077c1e1 100644 --- a/mozilla/suite/browser/navigator.xul +++ b/mozilla/suite/browser/navigator.xul @@ -1,5 +1,27 @@ - + + + + + - - + - + - + @@ -43,7 +64,7 @@ - + @@ -150,8 +171,6 @@ - - @@ -168,6 +187,10 @@ + + + + @@ -223,6 +246,13 @@ + + + + + + + @@ -239,13 +269,12 @@ - + - @@ -257,15 +286,19 @@ ]> + titleseperator ="&mainWindow.titlemodifierseperator;" windowtype="navigator:browser" + align="vertical" width="640" height="480"> + + + @@ -287,6 +320,14 @@ + + + + + + + @@ -307,7 +348,6 @@ - @@ -316,7 +356,7 @@ - + @@ -372,9 +412,11 @@ - + + + @@ -500,7 +542,7 @@ - + @@ -510,8 +552,6 @@ - - @@ -526,7 +566,7 @@ - + @@ -534,94 +574,103 @@ + onclick="window.content.location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'"/> + onclick="window.content.location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'"/> // Menu for testing. // Build verification sites. - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + // Viewer tests. - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + // XPToolkit tests. - - - - - - - + + + + + + + - + // QA tests. + + + + + - - + - + onclick="BrowserReallyReload(0)"> + - + @@ -663,7 +712,7 @@ + onclick="window.content.location.href='http://home.netscape.com'"/> @@ -706,16 +755,14 @@ - - - - @@ -733,5 +780,4 @@ - diff --git a/mozilla/suite/browser/viewSource.xul b/mozilla/suite/browser/viewSource.xul index 286475e71ae..14d3afa4fc9 100644 --- a/mozilla/suite/browser/viewSource.xul +++ b/mozilla/suite/browser/viewSource.xul @@ -1,10 +1,13 @@ - + + + + @@ -105,11 +108,13 @@ + onunload="Shutdown()" + title="&mainWindow.title;" titlemodifier="&mainWindow.titlemodifier;" + titleseperator ="&mainWindow.titlemodifierseperator;" windowtype="navigator:viewsource" + align="vertical" width="640" height="480"> - - + + @@ -254,10 +259,7 @@ - - - @@ -281,5 +283,4 @@ - diff --git a/mozilla/xpfe/browser/resources/content/Makefile.in b/mozilla/xpfe/browser/resources/content/Makefile.in index bd16765d582..7e2193c499b 100644 --- a/mozilla/xpfe/browser/resources/content/Makefile.in +++ b/mozilla/xpfe/browser/resources/content/Makefile.in @@ -27,6 +27,7 @@ include $(topsrcdir)/config/config.mk include $(topsrcdir)/config/rules.mk EXPORT_RESOURCE_CONTENT = \ + $(srcdir)/tooltip.js \ $(srcdir)/contentframe.js \ $(srcdir)/openLocation.js \ $(srcdir)/viewsource.js \ diff --git a/mozilla/xpfe/browser/resources/content/Manifest b/mozilla/xpfe/browser/resources/content/Manifest index 339d3aefe7c..b5fc6276700 100644 --- a/mozilla/xpfe/browser/resources/content/Manifest +++ b/mozilla/xpfe/browser/resources/content/Manifest @@ -10,4 +10,5 @@ NetSupportConfirm.xul NetSupportAlert.xul NetSupportConfirmCheck.xul NetSupportPassword.xul -NetSupportUserPassword.xul \ No newline at end of file +NetSupportUserPassword.xul +tooltip.js \ No newline at end of file diff --git a/mozilla/xpfe/browser/resources/content/NetSupportAlert.xul b/mozilla/xpfe/browser/resources/content/NetSupportAlert.xul index 8b6cd881cdf..17206d62513 100644 --- a/mozilla/xpfe/browser/resources/content/NetSupportAlert.xul +++ b/mozilla/xpfe/browser/resources/content/NetSupportAlert.xul @@ -1,5 +1,5 @@ - + - + - + - + - + - + .foo') +var sidebar_uri = ''; // Content to load in sidebar frame +var sidebar_width = 0; // Desired width of sidebar +var sidebar_pref = ''; // Base for preferences (e.g. 'sidebar.browser') +var is_sidebar_open = false; +var prefs = null; // Handle to preference interface -function Init() { - var pref = Components.classes['component://netscape/preferences']; - if (pref) { - pref = pref.getService(); +function init_sidebar(name, uri, width) { + sidebar_name = name; + sidebar_uri = uri; + sidebar_width = width; + sidebar_pref = 'sidebar.' + name; + + // Open/close sidebar based on saved pref. + // This may be replaced by another system by hyatt. + prefs = Components.classes['component://netscape/preferences']; + if (prefs) { + prefs = prefs.getService(); } - if (pref) { - pref = pref.QueryInterface(Components.interfaces.nsIPref); + if (prefs) { + prefs = prefs.QueryInterface(Components.interfaces.nsIPref); } - if (pref) { - pref.SetDefaultIntPref('sidebar.width', 170); - // pref.SetIntPref(pref.GetIntPref('sidebar.width')); - pref.SetDefaultBoolPref('sidebar.open', false); - pref.SavePrefFile(); - if (pref.GetBoolPref('sidebar.open')) { - toggleOpenClose(); + if (prefs) { + prefs.SetDefaultBoolPref(sidebar_pref + '.open', false); + + // The sidebar is closed by default, so open it only if the + // preference is set to true. + if (prefs.GetBoolPref(sidebar_pref + '.open')) { + toggle_open_close(); } } } -function toggleOpenClose() { - // Get the open width and update the pref state - var pref = Components.classes['component://netscape/preferences']; - if (pref) { - pref = pref.getService(); - } - if (pref) { - pref = pref.QueryInterface(Components.interfaces.nsIPref); - } - var width = 0; +function toggle_open_close() { - if (pref) { - pref.SetBoolPref('sidebar.open', !isSidebarOpen); - width = pref.GetIntPref('sidebar.width'); - pref.SavePrefFile(); - } + var sidebar = document.getElementById('sidebarframe'); + var grippy = document.getElementById('grippy'); - if (isSidebarOpen) + if (is_sidebar_open) { // Close it - var container = document.getElementById('container'); - var sidebar = container.firstChild; - sidebar.setAttribute('style','width:0px; visibility:hidden'); + sidebar.setAttribute('style','width: 0px'); sidebar.setAttribute('src','about:blank'); - //container.removeChild(container.firstChild); - var grippy = document.getElementById('grippy'); grippy.setAttribute('open',''); - isSidebarOpen = false; + is_sidebar_open = false; } else { // Open it - var container = document.getElementById('container'); - var sidebar = container.firstChild; - sidebar.setAttribute('style','width:' + width + 'px; visibility:visible'); - sidebar.setAttribute('src',sidebarURI); + sidebar.setAttribute('style', 'width:' + sidebar_width + 'px'); + sidebar.setAttribute('src', sidebar_uri); - //var sidebar = document.createElement('html:iframe'); - //sidebar.setAttribute('src','resource:/res/rdf/sidebar-browser.xul'); - //sidebar.setAttribute('class','sidebarframe'); - //container.insertBefore(sidebar,container.firstChild); - //container.appendChild(sidebar); - - var grippy = document.getElementById('grippy'); grippy.setAttribute('open','true'); - isSidebarOpen = true; + is_sidebar_open = true; } -} - -// To get around "window.onload" not working in viewer. -function Boot() -{ - var root = document.documentElement; - if (root == null) { - setTimeout(Boot, 0); - } else { - Init(); + // Save new open/close state in prefs + if (prefs) { + prefs.SetBoolPref(sidebar_pref + '.open', is_sidebar_open); } } - -setTimeout('Boot()', 0); diff --git a/mozilla/xpfe/browser/resources/content/contentframe.xul b/mozilla/xpfe/browser/resources/content/contentframe.xul index 5780c58f2bc..995e5d732d3 100644 --- a/mozilla/xpfe/browser/resources/content/contentframe.xul +++ b/mozilla/xpfe/browser/resources/content/contentframe.xul @@ -1,22 +1,22 @@ - - + + + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="init_sidebar('browser', 'resource:/res/rdf/sidebar-browser.xul', + 170);" align="horizontal"> - - - - - - - + + + + + + diff --git a/mozilla/xpfe/browser/resources/content/makefile.win b/mozilla/xpfe/browser/resources/content/makefile.win index fd14ddc7e6d..f69e2196690 100644 --- a/mozilla/xpfe/browser/resources/content/makefile.win +++ b/mozilla/xpfe/browser/resources/content/makefile.win @@ -35,7 +35,21 @@ install:: $(MAKE_INSTALL) NetSupportConfirmCheck.xul $(DISTBROWSWER) $(MAKE_INSTALL) NetSupportPassword.xul $(DISTBROWSWER) $(MAKE_INSTALL) NetSupportUserPassword.xul $(DISTBROWSWER) + $(MAKE_INSTALL) tooltip.js $(DISTBROWSWER) clobber:: - rm -f $(DIST)\bin\chrome\navigator\content\default\*.* + rm -f $(DISTBROWSER)\contentframe.js + rm -f $(DISTBROWSER)\openLocation.js + rm -f $(DISTBROWSER)\openLocation.xul + rm -f $(DISTBROWSER)\viewsource.js + rm -f $(DISTBROWSER)\viewSource.xul + rm -f $(DISTBROWSER)\contentframe.xul + rm -f $(DISTBROWSER)\navigator.xul + rm -f $(DISTBROWSER)\navigator.js + rm -f $(DISTBROWSER)\NetSupportConfirm.xul + rm -f $(DISTBROWSER)\NetSupportAlert.xul + rm -f $(DISTBROWSER)\NetSupportConfirmCheck.xul + rm -f $(DISTBROWSER)\NetSupportPassword.xul + rm -f $(DISTBROWSER)\NetSupportUserPassword.xul + rm -f $(DISTBROWSER)\tooltip.js diff --git a/mozilla/xpfe/browser/resources/content/navigator.js b/mozilla/xpfe/browser/resources/content/navigator.js index eb56e8fcbb7..2b1a5203962 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.js +++ b/mozilla/xpfe/browser/resources/content/navigator.js @@ -21,6 +21,7 @@ var appCoreName = ""; var defaultStatus = "default status text"; var debugSecurity = false; // Set this true to enable Security chrome testing. + var explicitURL = false; function Startup() { @@ -37,6 +38,15 @@ } } + function Shutdown() { + // Close the app core. + if ( appCore ) { + appCore.close(); + // Remove app core from app core manager. + XPAppCoresManager.Remove( appCore ); + } + } + function onLoadWithArgs() { // See if Startup has been run. if ( appCore ) { @@ -50,59 +60,73 @@ } else { // onLoad handler timing is not correct yet. dump( "onLoadWithArgs not needed yet\n" ); + // Remember that we want this url. + explicitURL = true; } } function tryToSetContentWindow() { - if ( window.frames[0].frames[1] ) { + if ( window.content ) { dump("Setting content window\n"); - appCore.setContentWindow( window.frames[0].frames[1] ); + appCore.setContentWindow( window.content ); // Have browser app core load appropriate initial page. - var pref = Components.classes['component://netscape/preferences']; - - // if all else fails, use trusty "about:" as the start page - var startpage = "about:"; - if (pref) { - pref = pref.getService(); + if ( !explicitURL ) { + var pref = Components.classes['component://netscape/preferences']; + dump("Components = " + Components + "\n"); + dump("Components.classes = " + Components.classes + "\n"); + dump("Components.classes[component://netscape/preferences] = " + pref + "\n"); + + // if all else fails, use trusty "about:blank" as the start page + var startpage = "about:blank"; + if (pref) { + pref = pref.getService(); + } + else { + dump("failed to get component://netscape/preferences\n"); + } + if (pref) { + pref = pref.QueryInterface(Components.interfaces.nsIPref); + } + else { + dump("failed to get pref service\n"); + } + if (pref) { + // from mozilla/modules/libpref/src/init/all.js + // 0 = blank + // 1 = home (browser.startup.homepage) + // 2 = last + choice = pref.GetIntPref("browser.startup.page"); + dump("browser.startup.page = " + choice + "\n"); + switch (choice) { + case 0: + startpage = "about:blank"; + break; + case 1: + startpage = pref.CopyCharPref("browser.startup.homepage"); + break; + case 2: + var history = Components.classes['component://netscape/browser/global-history']; + if (history) { + history = history.getService(); + } + if (history) { + history = history.QueryInterface(Components.interfaces.nsIGlobalHistory); + } + if (history) { + startpage = history.GetLastPageVisted(); + } + break; + default: + startpage = "about:blank"; + } + } + else { + dump("failed to QI pref service\n"); + } + dump("startpage = " + startpage + "\n"); + document.getElementById("args").setAttribute("value", startpage); } - if (pref) { - pref = pref.QueryInterface(Components.interfaces.nsIPref); - } - if (pref) { - // from mozilla/modules/libpref/src/init/all.js - // 0 = blank - // 1 = home (browser.startup.homepage) - // 2 = last - // 3 = splash (browser.startup.splash) - choice = pref.GetIntPref("browser.startup.page"); - switch (choice) { - case 0: - startpage = "about:blank"; - break; - case 1: - startpage = pref.CopyCharPref("browser.startup.homepage"); - break; - case 2: - var history = Components.classes['component://netscape/browser/global-history']; - if (history) { - history = history.getService(); - } - if (history) { - history = history.QueryInterface(Components.interfaces.nsIGlobalHistory); - } - if (history) { - startpage = history.GetLastPageVisted(); - } - break; - case 3: - startpage = pref.CopyCharPref("browser.startup.splash"); - break; - default: - startpage = "about:"; - } - } - document.getElementById("args").setAttribute("value", startpage); appCore.loadInitialPage(); } else { // Try again. @@ -117,16 +141,17 @@ service += "?AlisSourceLang=" + src; service += "&AlisTargetLang=" + dest; service += "&AlisMTEngine=SSI"; - service += "&AlisTargetURI=" + window.frames[0].frames[1].location.href; - window.frames[0].frames[1].location.href = service; + service += "&AlisTargetURI=" + window.content.location.href; + window.content.location.href = service; } function RefreshUrlbar() { //Refresh the urlbar bar - document.getElementById('urlbar').value = window.frames[0].frames[1].location.href; + document.getElementById('urlbar').value = window.content.location.href; } + function BrowserBack() { // Get a handle to the back-button @@ -143,6 +168,7 @@ } } + function BrowserForward() { // Get a handle to the back-button @@ -159,20 +185,21 @@ } } + function BrowserSetForward() { var forwardBElem = document.getElementById("canGoForward"); if (!forwardBElem) { - dump("Couldn't obtain handle to forward Broarcast element\n"); - return; - } + dump("Couldn't obtain handle to forward Broarcast element\n"); + return; + } var canForward = forwardBElem.getAttribute("disabled"); var fb = document.getElementById("forward-button"); if (!fb) { - dump("Could not obtain handle to forward button\n"); - return; + dump("Could not obtain handle to forward button\n"); + return; } // Enable/Disable the Forward button @@ -195,10 +222,8 @@ fm.setAttribute("disabled", "true"); } else { - dump("Setting forward menu item enabled\n"); fm.setAttribute("disabled", ""); - } - + } } function BrowserCanStop() { @@ -213,6 +238,15 @@ stopButton.setAttribute( "disabled", "" ); } } + //Enable/disable the stop menu item + var stopMenu = document.getElementById( "menuitem-stop" ); + if ( stopMenu ) { + if ( stopDisabled == "true") { + stopMenu.setAttribute( "disabled", "true" ); + } else { + stopMenu.setAttribute( "disabled", "" ); + } + } } } @@ -222,14 +256,14 @@ if (!stopBElem) { dump("Couldn't obtain handle to stop Broadcast element\n"); return; - } + } var canStop = stopBElem.getAttribute("disabled"); var sb = document.getElementById("stop-button"); if (!sb) { - dump("Could not obtain handle to stop button\n"); - return; + dump("Could not obtain handle to stop button\n"); + return; } // If the stop button is currently disabled, just return @@ -262,16 +296,16 @@ { var backBElem = document.getElementById("canGoBack"); if (!backBElem) { - dump("Couldn't obtain handle to back Broadcast element\n"); - return; - } + dump("Couldn't obtain handle to back Broadcast element\n"); + return; + } var canBack = backBElem.getAttribute("disabled"); var bb = document.getElementById("back-button"); if (!bb) { - dump("Could not obtain handle to back button\n"); - return; + dump("Could not obtain handle to back button\n"); + return; } // Enable/Disable the Back button @@ -294,16 +328,85 @@ bm.setAttribute("disabled", "true"); } else { - dump("Setting Back menuitem to enabled\n"); bm.setAttribute("disabled", ""); - } - + } + } + + + function BrowserSetReload() { + var reload = document.getElementById("canReload"); + if ( reload ) { + var reloadDisabled = reload.getAttribute("disabled"); + //Enable/disable the reload button + var reloadButton = document.getElementById( "reload-button" ); + + if ( reloadButton ) { + if ( reloadDisabled == "true") { + reloadButton.setAttribute( "disabled", "true" ); + } else { + reloadButton.setAttribute( "disabled", "" ); + } + } + //Enable/disable the reload menu + var reloadMenu = document.getElementById("menuitem-reload"); + if ( reloadMenu ) { + if ( reloadDisabled == "true") { + + reloadMenu.setAttribute( "disabled", "true" ); + } else { + + reloadMenu.setAttribute( "disabled", "" ); + } + } + } + } + + function BrowserReallyReload(reloadType) { + // Get a handle to the "canReload" broadcast id + var reloadBElem = document.getElementById("canReload"); + if (!reloadBElem) { + dump("Couldn't obtain handle to reload Broadcast element\n"); + return; + } + + var canreload = reloadBElem.getAttribute("disabled"); + var sb = document.getElementById("reload-button"); + if (!sb) { + dump("Could not obtain handle to reload button\n"); + return; + } + + // If the reload button is currently disabled, just return + if ((sb.getAttribute("disabled")) == "true") { + return; + } + + //reload button has just been pressed. Disable it. + sb.setAttribute("disabled", "true"); + + // Get a handle to the reload menu item. + var sm = document.getElementById("menuitem-reload"); + if (!sm) { + dump("Couldn't obtain menu item reload\n"); + } else { + // Disable the reload menu-item. + + sm.setAttribute("disabled", "true"); + } + + //Call in to BrowserAppcore to reload the current loading + if (appCore != null) { + dump("Going to reload\n"); + appCore.reload(reloadType); + } else { + dump("BrowserAppCore has not been created!\n"); + } } function BrowserHome() { - window.frames[0].frames[1].home(); + window.content.home(); RefreshUrlbar(); } @@ -319,7 +422,7 @@ return false; } - window.frames[0].frames[1].location.href = url; + window.content.location.href = url; RefreshUrlbar(); } @@ -343,7 +446,7 @@ } } if ( core ) { - core.ShowWindowWithArgs( "chrome://editor/content", window, "chrome://editor/content/EditorInitPage.html" ); + core.ShowWindowWithArgs( "chrome://editor/content", window, "resource:/res/html/empty_doc.html" ); } else { dump("Error; can't create toolkitCore\n"); } @@ -391,12 +494,12 @@ } } if ( core ) { - //core.ShowWindowWithArgs( "chrome:/navigator/content/openLocation.xul", window, appCoreName ); + //core.ShowWindowWithArgs( "resource:/res/samples/openLocation.xul", window, appCoreName ); var name = appCoreName.replace( /\./, /\_/ ); // Note: Use width/height one less than actual so resizing occurs. // This bypasses bug whereby dialog contents don't appear // till the dialog is resized. - window.openDialog( "chrome:/navigator/chrome/openLocation.xul", name+"_openLocation", "chrome,width=419,height=189", appCoreName ); + window.openDialog( "chrome://navigator/content/openLocation.xul", name+"_openLocation", "chrome,width=419,height=189", appCoreName ); } else { dump("Error; can't create toolkitCore\n"); } @@ -490,7 +593,7 @@ { if (appCore != null) { appCore.SetDocumentCharset(aCharset); - window.frames[0].frames[1].location.reload(); + window.content.location.reload(); } else { dump("BrowserAppCore has not been created!\n"); } @@ -585,7 +688,7 @@ { if (appCore != null) { dump("Wallet Safe Fillin\n"); - appCore.walletPreview(window, window.frames[0].frames[1]); + appCore.walletPreview(window, window.content); } else { dump("BrowserAppCore has not been created!\n"); } @@ -606,7 +709,7 @@ { if (appCore != null) { dump("Wallet Quick Fillin\n"); - appCore.walletQuickFillin(window.frames[0].frames[1]); + appCore.walletQuickFillin(window.content); } else { dump("BrowserAppCore has not been created!\n"); } @@ -644,32 +747,12 @@ function OpenMessenger() { - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow("chrome://messenger/content/", - window); - } + window.open("chrome://messenger/content/", "_new", "chrome"); } function OpenAddressbook() { - var toolkitCore = XPAppCoresManager.Find("ToolkitCore"); - if (!toolkitCore) { - toolkitCore = new ToolkitCore(); - if (toolkitCore) { - toolkitCore.Init("ToolkitCore"); - } - } - if (toolkitCore) { - toolkitCore.ShowWindow("chrome://addressbook/content/", - window); - } + window.open("chrome://addressbook/content/", "_new", "chrome"); } function MsgNewMessage() @@ -682,8 +765,8 @@ } } if (toolkitCore) { - toolkitCore.ShowWindow("chrome://messengercompose/content/", - window); + // We need to use ShowWindowWithArgs because message compose depend on callback + toolkitCore.ShowWindowWithArgs("chrome://messengercompose/content/", window, ""); } } @@ -706,9 +789,9 @@ } } if (toolkitCore) { - var url = window.frames[0].frames[1].location; + var url = window.content.location; dump("Opening view of source for" + url + "\n"); - toolkitCore.ShowWindowWithArgs("chrome:/navigator/content/viewSource.xul", window, url); + toolkitCore.ShowWindowWithArgs("chrome://navigator/content/viewSource.xul", window, url); } } @@ -783,16 +866,17 @@ var meter = document.getElementById("Browser:LoadingProgress"); if ( throbber && meter ) { var busy = throbber.getAttribute("busy"); + var wasBusy = meter.getAttribute("mode") == "undetermined" ? "true" : "false"; if ( busy == "true" ) { - mode = "undetermined"; - if ( !startTime ) { - startTime = (new Date()).getTime(); - } - } else { - mode = "normal"; - } - meter.setAttribute("mode",mode); - if ( mode == "normal" ) { + if ( wasBusy == "false" ) { + // Remember when loading commenced. + startTime = (new Date()).getTime(); + // Turn progress meter on. + meter.setAttribute("mode","undetermined"); + } + // Update status bar. + } else if ( busy == "false" && wasBusy == "true" ) { + // Record page loading time. var status = document.getElementById("Browser:Status"); if ( status ) { var elapsed = ( (new Date()).getTime() - startTime ) / 1000; @@ -801,7 +885,8 @@ status.setAttribute("value",msg); defaultStatus = msg; } - startTime = 0; + // Turn progress meter off. + meter.setAttribute("mode","normal"); } } } diff --git a/mozilla/xpfe/browser/resources/content/navigator.xul b/mozilla/xpfe/browser/resources/content/navigator.xul index 2c0d37ebef3..c665077c1e1 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.xul +++ b/mozilla/xpfe/browser/resources/content/navigator.xul @@ -1,5 +1,27 @@ - + + + + + - - + - + - + @@ -43,7 +64,7 @@ - + @@ -150,8 +171,6 @@ - - @@ -168,6 +187,10 @@ + + + + @@ -223,6 +246,13 @@ + + + + + + + @@ -239,13 +269,12 @@ - + - @@ -257,15 +286,19 @@ ]> + titleseperator ="&mainWindow.titlemodifierseperator;" windowtype="navigator:browser" + align="vertical" width="640" height="480"> + + + @@ -287,6 +320,14 @@ + + + + + + + @@ -307,7 +348,6 @@ - @@ -316,7 +356,7 @@ - + @@ -372,9 +412,11 @@ - + + + @@ -500,7 +542,7 @@ - + @@ -510,8 +552,6 @@ - - @@ -526,7 +566,7 @@ - + @@ -534,94 +574,103 @@ + onclick="window.content.location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'"/> + onclick="window.content.location.href='http://www.mozilla.org/projects/seamonkey/release-notes/index.html'"/> // Menu for testing. // Build verification sites. - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + // Viewer tests. - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + // XPToolkit tests. - - - - - - - + + + + + + + - + // QA tests. + + + + + - - + - + onclick="BrowserReallyReload(0)"> + - + @@ -663,7 +712,7 @@ + onclick="window.content.location.href='http://home.netscape.com'"/> @@ -706,16 +755,14 @@ - - - - @@ -733,5 +780,4 @@ - diff --git a/mozilla/xpfe/browser/resources/content/tooltip.js b/mozilla/xpfe/browser/resources/content/tooltip.js new file mode 100644 index 00000000000..166d09c4ac7 --- /dev/null +++ b/mozilla/xpfe/browser/resources/content/tooltip.js @@ -0,0 +1,32 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +function FillInTooltip ( tipElement ) +{ + var retVal = false; + var button = document.getElementById('replaceMe'); + if ( button ) { + var tipText = tipElement.getAttribute('tooltiptext'); + if ( tipText != "" ) { + button.setAttribute('value', tipText); + retVal = true; + } + } + + return retVal; +} diff --git a/mozilla/xpfe/browser/resources/content/unknownContent.xul b/mozilla/xpfe/browser/resources/content/unknownContent.xul new file mode 100644 index 00000000000..ba29e295899 --- /dev/null +++ b/mozilla/xpfe/browser/resources/content/unknownContent.xul @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + var data; + var dialog; + + function initData() { + // Create data object and initialize. + data = new Object; + data.location = document.getElementById("data.location"); + data.contentType = document.getElementById("data.contentType"); + data.execute = document.getElementById("data.execute"); + } + + function initDialog() { + // Create dialog object and initialize. + dialog = new Object; + dialog.contentType = document.getElementById("dialog.contentType"); + dialog.more = document.getElementById("dialog.more"); + dialog.pick = document.getElementById("dialog.pick"); + dialog.save = document.getElementById("dialog.save"); + dialog.cancel = document.getElementById("dialog.cancel"); + } + + function loadDialog() { + // Set initial dialog field contents. + dialog.contentType.childNodes[0].nodeValue = " " + data.contentType.getAttribute( "value" ); + } + + function onLoad() { + // Init data. + initData(); + + // Init dialog. + initDialog(); + + // Fill dialog. + loadDialog(); + } + + function more() { + dump( "unknownContent::more not implemented\n" ); + } + + function pick() { + dump( "unknownContent::pick not implemented\n" ); + } + + function save() { + // Execute "save to disk" logic. + data.execute.setAttribute("command","save"); + } + + function cancel() { + // Close the window. + data.execute.setAttribute("command","close"); + } + + + + + + + You have started to download a file of type + + contentType goes here + + + + + + + More Info... + + + Pick App... + + + Save File... + + + Cancel + + + + + diff --git a/mozilla/xpfe/browser/resources/content/viewSource.xul b/mozilla/xpfe/browser/resources/content/viewSource.xul index 286475e71ae..14d3afa4fc9 100644 --- a/mozilla/xpfe/browser/resources/content/viewSource.xul +++ b/mozilla/xpfe/browser/resources/content/viewSource.xul @@ -1,10 +1,13 @@ - + + + + @@ -105,11 +108,13 @@ + onunload="Shutdown()" + title="&mainWindow.title;" titlemodifier="&mainWindow.titlemodifier;" + titleseperator ="&mainWindow.titlemodifierseperator;" windowtype="navigator:viewsource" + align="vertical" width="640" height="480"> - - + + @@ -254,10 +259,7 @@ - - - @@ -281,5 +283,4 @@ -