Bug 261790 port various changes betwen xpfe/toolkit

r=mconnor sr=neil
This commit is contained in:
cbiesinger%web.de 2004-09-30 14:31:42 +00:00
parent e19211b830
commit c9a0f13bf5
31 changed files with 105 additions and 119 deletions

View File

@ -1 +1,2 @@
Makefile
buildconfig.html

View File

@ -80,7 +80,7 @@ function SelectDetector(event, doReload)
str.data = prefvalue;
pref.setComplexValue("intl.charset.detector",
Components.interfaces.nsISupportsString, str);
if (doReload) window._content.location.reload();
if (doReload) window.content.location.reload();
}
catch (ex) {
dump("Failed to set the intl.charset.detector preference.\n");
@ -130,7 +130,7 @@ function UpdateCurrentCharset()
// exctract the charset from DOM
var wnd = document.commandDispatcher.focusedWindow;
if ((window == wnd) || (wnd == null)) wnd = window._content;
if ((window == wnd) || (wnd == null)) wnd = window.content;
menuitem = document.getElementById('charset.' + wnd.document.characterSet);
if (menuitem) {
@ -215,7 +215,7 @@ var gLastBrowserCharset = null;
function charsetLoadListener (event)
{
var charset = window._content.document.characterSet;
var charset = window.content.document.characterSet;
if (charset.length > 0 && (charset != gLastBrowserCharset)) {
gCharsetMenu.SetCurrentCharset(charset);
@ -227,7 +227,7 @@ function charsetLoadListener (event)
function composercharsetLoadListener (event)
{
var charset = window._content.document.characterSet;
var charset = window.content.document.characterSet;
if (charset.length > 0 ) {

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/charsetOverlay.dtd">
<!DOCTYPE overlay SYSTEM "chrome://global/locale/charsetOverlay.dtd">
<overlay id="charsetOverlay"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -144,7 +144,7 @@
<menupopup>
</menupopup>
</menu>
<menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
<menu label="&charsetMenuMore.label;" accesskey="&charsetMenuMore.accesskey;" datasources="rdf:charset-menu" ref="NC:BrowserMoreCharsetMenuRoot">
<template>
<rule>
<menupopup>

View File

@ -49,8 +49,6 @@
</vbox>
</hbox>
<separator class="thin"/>
<!-- This method is called inline because it may unset hidden="true" on the
above boxes, causing their frames to be build and bindings to load.
So, by calling this inline, we guarantee the textboxes and checkboxes

View File

@ -61,7 +61,7 @@ function goQuitApplication()
{
var domWindow = enumerator.getNext();
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
return false;
return false;
domWindow.close();
};
appShell.quit(Components.interfaces.nsIAppShellService.eAttemptQuit);
@ -96,8 +96,7 @@ function goDoCommand(command)
controller.doCommand(command);
}
catch (e) {
dump("An error occurred executing the "+command+" command\n");
dump(e+"\n")
dump("An error occurred executing the " + command + " command\n" + e + "\n");
}
}

View File

@ -80,7 +80,7 @@ var nsTransferable = {
{
// non-string data.
supports = currData.supports;
length = 0; // kFlavorHasDataProvider
length = 0; // kFlavorHasDataProvider
}
trans.setTransferData(currFlavour, supports, length * 2);
}

View File

@ -411,7 +411,7 @@
<field name="securityUI">
null
</field>
<field name="userTypedClear">
true
</field>
@ -434,7 +434,7 @@
<field name="focusedElement">
null
</field>
</field>
<constructor>
<![CDATA[

View File

@ -472,20 +472,6 @@
]]></body>
</method>
<method name="getElementByanonid">
<parameter name="aValue"/>
<body><![CDATA[
var nodes = document.getAnonymousNodes(this);
var results;
for (var i = 0; i < nodes.length; i++) {
results = nodes[i].getElementsByAttribute("anonid", aValue);
if (results.item(0))
return results[0];
}
return null;
]]></body>
</method>
<method name="showPopup">
<body><![CDATA[
this.mPicker.parentNode.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");

View File

@ -215,7 +215,6 @@
for (dlgtype in buttons) {
var button = buttons[dlgtype];
button.addEventListener("command", this._handleButtonCommand, true);
// don't override custom labels with pre-defined labels on explicit buttons
if (!button.hasAttribute("label")) {

View File

@ -74,10 +74,10 @@
onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
<property name="editingSession"
readonly="true"
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>"
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIEditingSession);"/>
<property name="commandManager"
readonly="true"
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>"
onget="return this.webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsICommandManager);"/>
</implementation>
</binding>

View File

@ -306,10 +306,7 @@
if (popup)
arr = popup.getElementsByAttribute('label', this.inputField.value);
if (arr && arr.item(0))
this.setSelectionInternal(arr[0]);
else
this.setSelectionInternal(null);
this.setSelectionInternal(arr ? arr.item(0) : null);
]]>
</body>
</method>

View File

@ -33,7 +33,7 @@
return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
}
catch (e) {
dump("*** Failed to get string " + aStringKey + " in bundle: " + this.src + "\n");
dump("*** Failed to format string " + aStringKey + " in bundle: " + this.src + "\n");
throw e;
}
]]>

View File

@ -192,7 +192,7 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
if (aStateFlags & nsIWebProgressListener.STATE_START &&
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
// It's okay to clear what the user typed when we start
// loading a document. If the user types, this flag gets
@ -205,7 +205,7 @@
if (!this.mBlank) {
this.mTab.setAttribute("busy", "true");
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
this.mTab.removeAttribute("image");
this.mTab.removeAttribute("image");
this.mIcon = "";
if (this.mTabBrowser.mCurrentTab == this.mTab)
@ -227,7 +227,7 @@
var location = aRequest.QueryInterface(nsIChannel).URI;
if (this.mIcon) {
this.mTab.setAttribute("image", this.mIcon);
mIcon = "";
this.mIcon = "";
}
else if (this.mTabBrowser.shouldLoadFavIcon(location))
this.mTabBrowser.loadFavIcon(location, "image", this.mTab);
@ -246,10 +246,10 @@
p.onStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
}
}
}
,
},
onLocationChange : function(aWebProgress, aRequest, aLocation) {
onLocationChange : function(aWebProgress, aRequest, aLocation)
{
// The document loaded correctly, clear the value if we should
if (this.mBrowser.userTypedClear)
this.mBrowser.userTypedValue = null;
@ -263,7 +263,8 @@
}
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
if (this.mBlank)
return;
@ -295,8 +296,7 @@
return this;
throw Components.results.NS_NOINTERFACE;
}
});
});
]]>
</body>
</method>
@ -316,7 +316,7 @@
<body>
<![CDATA[
return (aURI && this.mPrefs.getBoolPref("browser.chrome.site_icons") &&
this.mPrefs.getBoolPref("browser.chrome.favicons") &&
this.mPrefs.getBoolPref("browser.chrome.favicons") &&
("schemeIs" in aURI) && (aURI.schemeIs("http") || aURI.schemeIs("https")));
]]>
</body>
@ -484,7 +484,7 @@
// Update the window title.
this.updateTitlebar();
// If the new tab is busy, and our current state is not busy, then
// we need to fire a start to all progress listeners.
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
@ -769,7 +769,9 @@
}
// Wire up a progress listener to our filter.
const listener = this.mTabProgressListener(this.mCurrentTab, this.mCurrentBrowser, false);
const listener = this.mTabProgressListener(this.mCurrentTab,
this.mCurrentBrowser,
false);
filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[0] = listener;
]]>
@ -783,16 +785,14 @@
<parameter name="aPostData"/>
<body>
<![CDATA[
var blank = (aURI == "about:blank");
if (!this.mTabbedMode)
this.enterTabbedMode();
var b = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"browser");
var t = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"tab");
var blank = (aURI == "about:blank");
if (blank)
t.setAttribute("label", this.mStringBundle.getString("tabs.untitled"));
else
@ -807,6 +807,8 @@
t.setAttribute("onerror", "this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image')); this.removeAttribute('image');");
this.mTabContainer.appendChild(t);
var b = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"browser");
b.setAttribute("type", "content");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));

View File

@ -30,7 +30,7 @@
<property name="view"
onget="return this.treeBoxObject.view;"
onset="return this.treeBoxObject.view=val;"/>
onset="return this.treeBoxObject.view = val;"/>
<property name="body"
onget="return this.treeBoxObject.treeBody;"/>
@ -57,7 +57,7 @@
<property name="currentIndex"
onget="return this.treeBoxObject.view.selection.currentIndex;"
onset="return this.treeBoxObject.view.selection.currentIndex=val;"/>
onset="return this.treeBoxObject.view.selection.currentIndex = val;"/>
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
@ -802,16 +802,17 @@
var tree = col.parentNode.parentNode;
var sib;
var column;
if (col.mTargetCol) {
// remove previous insertbefore/after attributes
col.mTargetCol.removeAttribute("insertbefore");
col.mTargetCol.removeAttribute("insertafter");
var column = tree.columns.getColumnFor(col.mTargetCol);
column = tree.columns.getColumnFor(col.mTargetCol);
tree.treeBoxObject.invalidateColumn(column);
sib = col.mTargetCol._previousVisibleColumn;
if (sib) {
sib.removeAttribute("insertafter");
var column = tree.columns.getColumnFor(sib);
column = tree.columns.getColumnFor(sib);
tree.treeBoxObject.invalidateColumn(column);
}
col.mTargetCol = null;
@ -827,11 +828,11 @@
sib = targetCol._previousVisibleColumn;
if (sib) {
sib.setAttribute("insertafter", "true");
var column = tree.columns.getColumnFor(sib);
column = tree.columns.getColumnFor(sib);
tree.treeBoxObject.invalidateColumn(column);
}
}
var column = tree.columns.getColumnFor(targetCol);
column = tree.columns.getColumnFor(targetCol);
tree.treeBoxObject.invalidateColumn(column);
col.mTargetCol = targetCol;
col.mTargetDir = pos.value;

View File

@ -15,19 +15,18 @@
display: -moz-box;
}
/* hide the content, but don't destroy the frames. Make sure this
comes before any rules involving "hidden" */
*[collapsed="true"], *[moz-collapsed="true"] {
visibility: collapse;
}
/* The rule for hidden comes AFTER the rule for collapsed. That way if
both are specified on an element, the hidden rule wins. */
/* hide the content and destroy the frame */
*[hidden="true"] {
display: none;
}
/* hide the content, but don't destroy the frames */
*[collapsed="true"],
*[moz-collapsed="true"] {
visibility: collapse;
}
/* ::::::::::
:: Rules for 'hiding' portions of the chrome for special
:: kinds of windows (not JUST browser windows) with toolbars
@ -471,10 +470,6 @@ listbox {
height: 200px;
}
listhead, listrows, listboxbody {
-moz-user-focus: none;
}
listhead {
-moz-box-orient: vertical;
}
@ -522,7 +517,6 @@ treecol.treecol-image {
tree > treechildren {
display: -moz-box;
-moz-binding: url("chrome://global/content/bindings/tree.xml#treebody");
-moz-user-focus: none;
-moz-user-select: none;
-moz-box-flex: 1;
}
@ -782,14 +776,14 @@ menulist {
-moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist");
}
menulist[type="description"] {
-moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-description");
}
menulist[editable] {
-moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-editable");
}
menulist[type="description"] {
-moz-binding: url("chrome://global/content/bindings/menulist.xml#menulist-description");
}
html|*.menulist-editable-input {
-moz-appearance: none !important;
}
@ -842,6 +836,7 @@ scrollbar[value="hidden"] {
scrollbox {
-moz-binding: url("chrome://global/content/bindings/scrollbox.xml#scrollbox");
/* This makes it scrollable! */
overflow:hidden ! important;
}

View File

@ -97,7 +97,7 @@ function nsTreeController_copy()
if (isContainer(this.tree, k))
continue;
var col = this.tree.columns["URL"];
var pageUrl = this.treeView.getCellText(k, col);
var pageUrl = this.treeView.getCellText(k, col);
col = this.tree.columns["Name"];
var pageName = this.treeView.getCellText(k, col);

View File

@ -317,6 +317,10 @@
null
</field>
<property name="userTypedValue"
onget="return this._userTypedValue;"
onset="this.userTypedClear = 0; return this._userTypedValue = val;"/>
<field name="focusedWindow">
null
</field>
@ -325,10 +329,6 @@
null
</field>
<property name="userTypedValue"
onget="return this._userTypedValue;"
onset="this.userTypedClear = 0; return this._userTypedValue = val;"/>
<constructor>
<![CDATA[
try {
@ -394,10 +394,9 @@
var buttonPressed = promptService.confirmEx(window,
this.mStrBundle.GetStringFromName('browsewithcaret.checkWindowTitle'),
this.mStrBundle.GetStringFromName('browsewithcaret.checkLabel'),
(promptService.BUTTON_TITLE_OK * promptService.BUTTON_POS_0) +
(promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
null, null, null,
this.mStrBundle.GetStringFromName('browsewithcaret.checkMsg'),
(promptService.BUTTON_TITLE_YES * promptService.BUTTON_POS_0) +
(promptService.BUTTON_TITLE_NO * promptService.BUTTON_POS_1),
null, null, null, this.mStrBundle.GetStringFromName('browsewithcaret.checkMsg'),
checkValue);
if (buttonPressed != 0)
return;

View File

@ -196,7 +196,8 @@
// add the label and oncommand handler to each button
for (dlgtype in buttons) {
var button = buttons[dlgtype];
buttons[dlgtype].addEventListener("command", this._handleButtonCommand, true);
button.addEventListener("command", this._handleButtonCommand, true);
// don't override custom labels with pre-defined labels on explicit buttons
if (!button.hasAttribute("label")) {
button.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+dlgtype));
@ -206,15 +207,15 @@
}
}
}
// ensure that hitting enter triggers ondialogaccept
buttons["accept"].setAttribute("default", "true");
// if there is a special button configuration, use it
if (aButtons) {
// expect a comma delimitd list of dlgtype values
// expect a comma delimited list of dlgtype values
var list = aButtons.split(",");
// mark shown dlgtypes as true
var shown = { accept: false, cancel: false, help: false,
disclosure: false, extra1: false, extra2: false };
@ -222,12 +223,9 @@
shown[list[i].replace(/ /g, "")] = true;
// hide/show the buttons we want
for (dlgtype in shown) {
if (shown[dlgtype])
buttons[dlgtype].hidden = false;
else
buttons[dlgtype].hidden = true;
}
for (dlgtype in buttons)
buttons[dlgtype].hidden = !shown[dlgtype];
}
]]>
</body>

View File

@ -13,7 +13,13 @@
<parameter name="aStringKey"/>
<body>
<![CDATA[
return this.stringBundle.GetStringFromName(aStringKey);
try {
return this.stringBundle.GetStringFromName(aStringKey);
}
catch (e) {
dump("*** Failed to get string " + aStringKey + " in bundle: " + this.src + "\n");
throw e;
}
]]>
</body>
</method>
@ -23,7 +29,13 @@
<parameter name="aStringsArray"/>
<body>
<![CDATA[
return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
try {
return this.stringBundle.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length);
}
catch (e) {
dump("*** Failed to format string " + aStringKey + " in bundle: " + this.src + "\n");
throw e;
}
]]>
</body>
</method>

View File

@ -629,10 +629,11 @@
if (!href)
return;
const nsIContentPolicy = Components.interfaces.nsIContentPolicy;
try {
var contentPolicy =
Components.classes['@mozilla.org/layout/content-policy;1']
.getService(Components.interfaces.nsIContentPolicy);
.getService(nsIContentPolicy);
} catch(e) {
return; // Refuse to load if we can't do a security check.
}
@ -673,10 +674,10 @@
// We need to update a tab.
for (i = 0; i < this.browsers.length; i++) {
if (this.browsers[i].contentDocument == event.originalTarget.ownerDocument) {
if (contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.TYPE_IMAGE,
if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_IMAGE,
uri, origURI, event.target,
safeGetProperty(event.target, "type"),
null) != Components.interfaces.nsIContentPolicy.ACCEPT)
null) != nsIContentPolicy.ACCEPT)
return;
this.mTabListeners[i].mIcon = href;
@ -686,10 +687,10 @@
}
}
else if ((this.contentDocument != event.originalTarget.ownerDocument) ||
(contentPolicy.shouldLoad(Components.interfaces.nsIContentPolicy.TYPE_IMAGE,
(contentPolicy.shouldLoad(nsIContentPolicy.TYPE_IMAGE,
uri, origURI, event.target,
safeGetProperty(event.target, "type"),
null) != Components.interfaces.nsIContentPolicy.ACCEPT))
null) != nsIContentPolicy.ACCEPT))
return;
if (notifyListeners && this.mProgressListeners) {

View File

@ -59,7 +59,7 @@
if (val) this.setAttribute('readonly', 'true');
else this.removeAttribute('readonly'); return val;"
onget="return this.inputField.readonly;"/>
<method name="select">
<body>
this.inputField.select();

View File

@ -248,7 +248,7 @@
]]>
</handler>
<handler event="focus" action="this.treeBoxObject.focused = true;"/>
<handler event="blur" action="this.treeBoxObject.focused = false;"/>
<handler event="blur" action="this.treeBoxObject.focused = false;"/>
<handler event="keypress" keycode="vk_enter" action="this.changeOpenState(this.currentIndex);"/>
<handler event="keypress" keycode="vk_return" action="this.changeOpenState(this.currentIndex);"/>
<handler event="keypress" keycode="vk_left">

View File

@ -208,9 +208,9 @@ function UpdateMenus(event)
// when onmenucomplete is ready then use it instead of oncreate
// see bug 78290 for the detail
UpdateCurrentCharset();
setTimeout("UpdateCurrentCharset()", 0);
setTimeout(UpdateCurrentCharset, 0);
UpdateCharsetDetector();
setTimeout("UpdateCharsetDetector()", 0);
setTimeout(UpdateCharsetDetector, 0);
}
function CreateMenu(node)
@ -225,9 +225,9 @@ function UpdateMailMenus(event)
// when onmenucomplete is ready then use it instead of oncreate
// see bug 78290 for the detail
UpdateCurrentMailCharset();
setTimeout("UpdateCurrentMailCharset()", 0);
setTimeout(UpdateCurrentMailCharset, 0);
UpdateCharsetDetector();
setTimeout("UpdateCharsetDetector()", 0);
setTimeout(UpdateCharsetDetector, 0);
}
var gCharsetMenu = Components.classes['@mozilla.org/rdf/datasource;1?name=charset-menu'].getService().QueryInterface(Components.interfaces.nsICurrentCharsetListener);

View File

@ -208,9 +208,9 @@ function commonDialogOnLoad()
function commonDialogReenableButtons()
{
document.documentElement.getButton("accept").disabled = false;
document.documentElement.getButton("extra1").disabled = false;
document.documentElement.getButton("extra2").disabled = false;
document.documentElement.getButton("accept").disabled = false;
document.documentElement.getButton("extra1").disabled = false;
document.documentElement.getButton("extra2").disabled = false;
}
function initTextbox(aName, aLabelIndex, aValueIndex, aAlwaysLabel)

View File

@ -106,7 +106,7 @@ var view = {
isContainerOpen : function(index) { return false; },
isContainerEmpty : function(index) { return false; },
isSorted : function() { return true; },
canDrop : function(index, orienation) { return false; },
canDrop : function(index, orientation) { return false; },
drop : function(row, orientation) {},
setTree : function(out) { this.treebox = out; },
getParentIndex: function(rowIndex) { return -1; },

View File

@ -105,4 +105,3 @@
<treechildren id="configTreeBody" ondblclick="if (event.button == 0) ModifySelected();"/>
</tree>
</window>

View File

@ -5,8 +5,8 @@
<!DOCTYPE overlay SYSTEM "chrome://global/locale/dialogOverlay.dtd">
<overlay id="dialogOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js"/>
</overlay>

View File

@ -39,7 +39,7 @@
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://communicator/skin" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://global/locale/fontpackage.dtd">
<dialog title="&window.title;"

View File

@ -69,7 +69,7 @@ function goDoCommand(command)
controller.doCommand(command);
}
catch (e) {
dump("An error occurred executing the "+command+" command\n");
dump("An error occurred executing the " + command + " command\n" + e + "\n");
}
}

View File

@ -78,7 +78,7 @@ var nsTransferable = {
}
else
{
// non-string data.
// non-string data.
supports = currData.supports;
length = 0; // kFlavorHasDataProvider
}

View File

@ -59,8 +59,7 @@ menulist.uri-element
/****** elements that have no visual representation ******/
script,
data,
script, data,
xbl|children,
commands, commandset, command,
broadcasterset, broadcaster, observes,