Bug 302847 : Remove lookupMethod code from toolkit/, patch by Frank Wein <bugzilla@mcsmurf.de>, r=mconnor+Neil, a=bsmedberg

This commit is contained in:
gavin%gavinsharp.com 2005-08-02 12:34:55 +00:00
Родитель 8f2b10bef9
Коммит d953705f08
3 изменённых файлов: 9 добавлений и 21 удалений

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

@ -167,17 +167,14 @@ function isContentFrame(aFocusedWindow)
if (!aFocusedWindow)
return false;
var focusedTop = Components.lookupMethod(aFocusedWindow, 'top')
.call(aFocusedWindow);
return (focusedTop == window.content);
return (aFocusedWindow.top == window.content);
}
function getContentFrameURI(aFocusedWindow)
{
var contentFrame = isContentFrame(aFocusedWindow) ? aFocusedWindow : window.content;
if (contentFrame)
return Components.lookupMethod(contentFrame, 'location').call(contentFrame).href;
return contentFrame.location.href;
else
return null;
}

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

@ -306,7 +306,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">

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

@ -713,7 +713,7 @@
function setFocus(element) {
document.commandDispatcher.suppressFocusScroll = true;
Components.lookupMethod(element, "focus").call(element);
element.focus();
document.commandDispatcher.suppressFocusScroll = false;
}
@ -741,12 +741,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);
};
var tabBrowser = this.parentNode.parentNode;
if (!tabBrowser.mPrefs.getBoolPref("browser.chrome.site_icons"))
return;
@ -779,13 +773,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;
@ -800,7 +792,7 @@
// Security says okay, now ask content policy
if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_IMAGE,
uri, origURI, event.target,
safeGetProperty(event.target, "type"),
event.target.type,
null) != nsIContentPolicy.ACCEPT)
return;
@ -861,8 +853,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);