Bug 295582 Clean up after bug 281988 p=jklippl@xtux.org r=me sr=jag a=bsmedberg

This commit is contained in:
neil%parkwaycc.co.uk 2005-07-28 13:44:23 +00:00
Родитель 2338bdd85d
Коммит fc0924b7e2
9 изменённых файлов: 30 добавлений и 59 удалений

Просмотреть файл

@ -109,7 +109,6 @@
aDocument = window.content.document;
try {
aDocument = new XPCNativeWrapper(aDocument, "URL", "title");
openComposeWindow(aDocument.URL, aDocument.title, 0, null);
} catch(ex) { dump("Cannot Send Link: " + ex + "\n"); }
}
@ -129,7 +128,6 @@
try {
var charset = getCharsetforSave(aDocument);
aDocument = new XPCNativeWrapper(aDocument, "URL", "title");
openComposeWindow(aDocument.URL, aDocument.title, 1, charset);
} catch(ex) { dump("Cannot Send Page: " + ex + "\n"); }
}
@ -223,7 +221,7 @@
<menuitem insertafter="saveframeas"
label="&contextSendFrame.label;"
accesskey="&contextSendFrame.accesskey;"
oncommand="sendPage(new XPCNativeWrapper(gContextMenu.target, 'ownerDocument').ownerDocument);"/>
oncommand="sendPage(gContextMenu.target.ownerDocument);"/>
</menupopup>
</menu>
</popup>

Просмотреть файл

@ -278,7 +278,7 @@ function getContentAreaFrameCount()
// When a content area frame is focused, update the focused frame URL
function contentAreaFrameFocus()
{
var focusedWindow = new XPCNativeWrapper(document.commandDispatcher.focusedWindow, "top", "document", "location");
const focusedWindow = document.commandDispatcher.focusedWindow;
if (focusedWindow.top == window.content) {
gFocusedURL = focusedWindow.location.href;
gFocusedDocument = focusedWindow.document;
@ -476,7 +476,6 @@ nsBrowserAccess.prototype = {
gBrowser.loadURIWithFlags(uri, loadflags);
return content;
}
aOpener = new XPCNativeWrapper(aOpener, "top").top;
try {
aOpener.QueryInterface(nsIInterfaceRequestor)
.getInterface(nsIWebNavigation)
@ -2495,9 +2494,7 @@ function maybeInitPopupContext()
// return our opener's URI
const IOS = Components.classes["@mozilla.org/network/io-service;1"]
.getService(CI.nsIIOService);
var opener = new XPCNativeWrapper(window.content, "opener").opener;
var location = new XPCNativeWrapper(opener, "location").location;
return IOS.newURI(location.href, null, null);
return IOS.newURI(window.content.opener.location.href, null, null);
}
} catch(e) {
}

Просмотреть файл

@ -559,8 +559,7 @@ function grabAll(elem)
// we need to use a special access method, XPCNativeWrapper, to get their real values
if ("form" in elem && elem.form)
{
var formWrapper = new XPCNativeWrapper(elem.form, "target", "action");
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, formWrapper.action, gStrings.linkSubmission, formWrapper.target]);
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, elem.form.action, gStrings.linkSubmission, elem.form.target]);
}
else
linkView.addRow([elem.value || getValueText(elem) || gStrings.linkSubmit, '', gStrings.linkSubmission, '']);
@ -568,8 +567,7 @@ function grabAll(elem)
}
else if (elem instanceof nsIFormElement)
{
formWrapper = new XPCNativeWrapper(elem, "name", "method", "action");
formView.addRow([formWrapper.name, formWrapper.method, formWrapper.action, elem]);
formView.addRow([elem.name, elem.method, elem.action, elem]);
}
else if (elem instanceof nsIAppletElement)
{
@ -609,18 +607,16 @@ function onFormSelect()
var clickedRow = formView.selection.currentIndex;
// form-node;
var form = formView.data[clickedRow][3];
const formWrapper = new XPCNativeWrapper(form,
"name", "elements", "encoding", "target", "getElementsByTagName()");
var ft = null;
if (formWrapper.name)
ft = theBundle.getFormattedString("formTitle", [formWrapper.name]);
if (form.name)
ft = theBundle.getFormattedString("formTitle", [form.name]);
setItemValue("formenctype", formWrapper.encoding, theBundle.getString("default"));
setItemValue("formtarget", formWrapper.target, theBundle.getString("formDefaultTarget"));
setItemValue("formenctype", form.encoding, theBundle.getString("default"));
setItemValue("formtarget", form.target, theBundle.getString("formDefaultTarget"));
document.getElementById("formname").value = ft || theBundle.getString("formUntitled");
var formfields = formWrapper.elements;
var formfields = form.elements;
var length = formfields.length;
@ -639,7 +635,7 @@ function onFormSelect()
fieldView.addRow(["", elem.name, elem.type, val]);
}
var labels = formWrapper.getElementsByTagName("label");
var labels = form.getElementsByTagName("label");
var llength = labels.length;
var label;

Просмотреть файл

@ -144,21 +144,19 @@
}
var href;
if (linkNode) {
href = new XPCNativeWrapper(linkNode, "href").href;
href = linkNode.href;
} else {
// Try simple XLink
linkNode = target;
while (linkNode) {
if (linkNode.nodeType == Node.ELEMENT_NODE) {
var wrapper = new XPCNativeWrapper(linkNode, "getAttributeNS()");
href = wrapper.getAttributeNS("http://www.w3.org/1999/xlink", "href");
href = linkNode.getAttributeNS("http://www.w3.org/1999/xlink", "href");
break;
}
linkNode = linkNode.parentNode;
}
if (href && href != "") {
var baseURI = new XPCNativeWrapper(linkNode, "baseURI").baseURI;
href = makeURLAbsolute(baseURI, href);
href = makeURLAbsolute(linkNode.baseURI, href);
}
}
return href;

Просмотреть файл

@ -45,9 +45,7 @@ function isContentFrame(aFocusedWindow)
if (!aFocusedWindow)
return false;
var focusedTop = new XPCNativeWrapper(aFocusedWindow, 'top').top;
return (focusedTop == window.content);
return (aFocusedWindow.top == window.content);
}
function urlSecurityCheck(url, doc)
@ -68,7 +66,7 @@ function urlSecurityCheck(url, doc)
function getContentFrameURI(aFocusedWindow)
{
var contentFrame = isContentFrame(aFocusedWindow) ? aFocusedWindow : window.content;
return new XPCNativeWrapper(contentFrame, "location").location.href;
return contentFrame.location.href;
}
function getReferrer(doc)

Просмотреть файл

@ -441,9 +441,7 @@ nsContextMenu.prototype = {
// initialize popupURL
const IOS = Components.classes["@mozilla.org/network/io-service;1"]
.getService(CI.nsIIOService);
var opener = new XPCNativeWrapper(window.content, "opener").opener;
var location = new XPCNativeWrapper(opener, "location").location;
this.popupURL = IOS.newURI(location.href, null, null);
this.popupURL = IOS.newURI(window.content.opener.location.href, null, null);
// but cancel if it's an unsuitable URL
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
@ -651,8 +649,7 @@ nsContextMenu.prototype = {
// Let's try to unescape it using a character set
try {
var ownerDocument = new XPCNativeWrapper(this.target, "ownerDocument").ownerDocument;
var characterSet = new XPCNativeWrapper(ownerDocument, "characterSet").characterSet;
var characterSet = this.target.ownerDocument.characterSet;
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
.getService(Components.interfaces.nsITextToSubURI);
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);

Просмотреть файл

@ -1521,9 +1521,8 @@ var BookmarksUtils = {
var name = "";
var charset;
try {
var doc = new XPCNativeWrapper(webNav.document, "title", "characterSet");
name = doc.title || url;
charset = doc.characterSet;
name = webNav.document.title || url;
charset = webNav.document.characterSet;
} catch (e) {
name = url;
}
@ -1550,9 +1549,8 @@ var BookmarksUtils = {
var url = aDocShell.currentURI.spec;
var title, docCharset = null;
try {
var doc = new XPCNativeWrapper(aDocShell.document, "title", "characterSet");
title = doc.title || url;
docCharset = doc.characterSet;
title = aDocShell.document.title || url;
docCharset = aDocShell.document.characterSet;
}
catch (e) {
title = url;

Просмотреть файл

@ -250,7 +250,7 @@
readonly="true"/>
<property name="contentTitle"
onget="return Components.lookupMethod(this.contentDocument, 'title').call(this.contentDocument);"
onget="return this.contentDocument.title;"
readonly="true"/>
<field name="mPrefs" readonly="true">

Просмотреть файл

@ -636,7 +636,7 @@
function setFocus(element) {
document.commandDispatcher.suppressFocusScroll = true;
Components.lookupMethod(element, "focus").call(element);
element.focus();
document.commandDispatcher.suppressFocusScroll = false;
}
@ -664,12 +664,6 @@
<parameter name="event"/>
<body>
<![CDATA[
// mechanism for reading properties of the underlying XPCOM object
// (ignoring potential getters/setters added by malicious content)
var safeGetProperty = function(obj, propname) {
return Components.lookupMethod(obj, propname).call(obj);
};
if (!this.mPrefs.getBoolPref("browser.chrome.site_icons"))
return;
@ -701,13 +695,11 @@
Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
const targetDoc = safeGetProperty(event.target, "ownerDocument");
const targetDoc = event.target.ownerDocument;
// Make a URI out of our href.
var docCharset = safeGetProperty(targetDoc, "characterSet");
var uri = ioService.newURI(href, docCharset, null);
var uri = ioService.newURI(href, targetDoc.characterSet, null);
var origURIStr = safeGetProperty(targetDoc, "documentURI");
var origURI = ioService.newURI(origURIStr, docCharset, null);
var origURI = ioService.newURI(targetDoc.documentURI, targetDoc.characterSet, null);
const nsIScriptSecMan =
Components.interfaces.nsIScriptSecurityManager;
@ -724,7 +716,7 @@
if (this.browsers[i].contentDocument == event.originalTarget.ownerDocument) {
if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_IMAGE,
uri, origURI, event.target,
safeGetProperty(event.target, "type"),
event.target.type,
null) == nsIContentPolicy.ACCEPT) {
this.mTabListeners[i].setIcon(href);
if (this.browsers[i] == this.mCurrentBrowser)
@ -786,8 +778,7 @@
// Let's try to unescape it using a character set
// in case the URI is not ASCII.
try {
var characterSet = Components.lookupMethod(browser.contentDocument, 'characterSet')
.call(browser.contentDocument);
var characterSet = browser.contentDocument.characterSet;
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
.getService(Components.interfaces.nsITextToSubURI);
title = textToSubURI.unEscapeNonAsciiURI(characterSet, title);
@ -1550,11 +1541,9 @@
// We're about to open a modal dialog, make sure the opening
// tab is brought to the front.
var targetTop = new XPCNativeWrapper(event.target, "top").top;
const browsers = this.browsers;
for (var i = 0; i < browsers.length; ++i) {
if (browsers[i].contentWindow == targetTop) {
if (browsers[i].contentWindow == event.target.top) {
this.selectedTab = this.mTabContainer.childNodes[i];
break;