Bug 220215 use the XPCNativeWrapper for Components.lookupMethod r=caillon sr=bz
git-svn-id: svn://10.0.0.236/trunk@156691 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -103,10 +103,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function sendLink(pageUrl, pageTitle)
|
||||
function sendLink(aDocument)
|
||||
{
|
||||
if (!aDocument)
|
||||
aDocument = window.content.document;
|
||||
|
||||
try {
|
||||
openComposeWindow(pageUrl, pageTitle, 0, null);
|
||||
aDocument = new XPCNativeWrapper(aDocument, "URL", "title");
|
||||
openComposeWindow(aDocument.URL, aDocument.title, 0, null);
|
||||
} catch(ex) { dump("Cannot Send Link: " + ex + "\n"); }
|
||||
}
|
||||
|
||||
@@ -123,12 +127,10 @@
|
||||
if (!aDocument)
|
||||
aDocument = window._content.document;
|
||||
|
||||
var charset = getCharsetforSave(aDocument);
|
||||
var pageUrl = aDocument.URL;
|
||||
var pageTitle = Components.lookupMethod(aDocument, 'title').call(aDocument);
|
||||
|
||||
try {
|
||||
openComposeWindow(pageUrl, pageTitle, 1, charset);
|
||||
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"); }
|
||||
}
|
||||
|
||||
@@ -175,9 +177,7 @@
|
||||
<command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
|
||||
<command id="cmd_newCard" oncommand="openNewCardDialog()"/>
|
||||
<command id="cmd_sendPage" oncommand="sendPage();"/>
|
||||
<command id="Browser:SendLink"
|
||||
oncommand="sendLink(Components.lookupMethod(window._content, 'location').call(window._content).href,
|
||||
Components.lookupMethod(window._content.document, 'title').call(window._content.document));"/>
|
||||
<command id="Browser:SendLink" oncommand="sendLink();"/>
|
||||
</commandset>
|
||||
<keyset id="tasksKeys">
|
||||
<key id="key_newMessage" key="&newMessageCmd.key;" command="cmd_newMessage" modifiers="accel"/>
|
||||
@@ -227,7 +227,7 @@
|
||||
<menuitem insertafter="saveframeas"
|
||||
label="&contextSendFrame.label;"
|
||||
accesskey="&contextSendFrame.accesskey;"
|
||||
oncommand="sendPage(gContextMenu.target.ownerDocument);"/>
|
||||
oncommand="sendPage(new XPCNativeWrapper(gContextMenu.target, 'ownerDocument').ownerDocument);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</popup>
|
||||
|
||||
@@ -275,9 +275,9 @@ function getContentAreaFrameCount()
|
||||
// When a content area frame is focused, update the focused frame URL
|
||||
function contentAreaFrameFocus()
|
||||
{
|
||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||
if (isContentFrame(focusedWindow)) {
|
||||
gFocusedURL = Components.lookupMethod(focusedWindow, 'location').call(focusedWindow).href;
|
||||
var focusedWindow = new XPCNativeWrapper(document.commandDispatcher.focusedWindow, "top", "document", "location");
|
||||
if (focusedWindow.top == window.content) {
|
||||
gFocusedURL = focusedWindow.location.href;
|
||||
gFocusedDocument = focusedWindow.document;
|
||||
}
|
||||
}
|
||||
@@ -2271,9 +2271,9 @@ function maybeInitPopupContext()
|
||||
// return our opener's URI
|
||||
const IOS = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(CI.nsIIOService);
|
||||
var spec = Components.lookupMethod(window.content.opener, "location")
|
||||
.call();
|
||||
return IOS.newURI(spec, null, null);
|
||||
var opener = new XPCNativeWrapper(window.content, "opener").opener;
|
||||
var location = new XPCNativeWrapper(opener, "location").location;
|
||||
return IOS.newURI(location.href, null, null);
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
</script>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/nsContextMenu.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/XPCNativeWrapper.js"/>
|
||||
|
||||
<popupset id="contentAreaContextSet">
|
||||
<!-- This is a generic context menu for a content area. It contains
|
||||
|
||||
@@ -45,8 +45,7 @@ function isContentFrame(aFocusedWindow)
|
||||
if (!aFocusedWindow)
|
||||
return false;
|
||||
|
||||
var focusedTop = Components.lookupMethod(aFocusedWindow, 'top')
|
||||
.call(aFocusedWindow);
|
||||
var focusedTop = new XPCNativeWrapper(aFocusedWindow, 'top').top;
|
||||
|
||||
return (focusedTop == window.content);
|
||||
}
|
||||
@@ -69,7 +68,7 @@ function urlSecurityCheck(url, doc)
|
||||
function getContentFrameURI(aFocusedWindow)
|
||||
{
|
||||
var contentFrame = isContentFrame(aFocusedWindow) ? aFocusedWindow : window.content;
|
||||
return Components.lookupMethod(contentFrame, 'location').call(contentFrame).href;
|
||||
return new XPCNativeWrapper(contentFrame, "location").location.href;
|
||||
}
|
||||
|
||||
function getReferrer(doc)
|
||||
|
||||
@@ -479,9 +479,9 @@ nsContextMenu.prototype = {
|
||||
// initialize popupURL
|
||||
const IOS = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(CI.nsIIOService);
|
||||
var spec = Components.lookupMethod(window.content.opener, "location")
|
||||
.call();
|
||||
this.popupURL = IOS.newURI(spec, null, null);
|
||||
var opener = new XPCNativeWrapper(window.content, "opener").opener;
|
||||
var location = new XPCNativeWrapper(opener, "location").location;
|
||||
this.popupURL = IOS.newURI(location.href, null, null);
|
||||
|
||||
// but cancel if it's an unsuitable URL
|
||||
const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
@@ -675,8 +675,8 @@ nsContextMenu.prototype = {
|
||||
// Let's try to unescape it using a character set
|
||||
// in case the address is not ASCII.
|
||||
try {
|
||||
var characterSet = Components.lookupMethod(this.target.ownerDocument, "characterSet")
|
||||
.call(this.target.ownerDocument);
|
||||
var ownerDocument = new XPCNativeWrapper(this.target, "ownerDocument").ownerDocument;
|
||||
var characterSet = new XPCNativeWrapper(ownerDocument, "characterSet").characterSet;
|
||||
const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
|
||||
.getService(Components.interfaces.nsITextToSubURI);
|
||||
addresses = textToSubURI.unEscapeNonAsciiURI(characterSet, addresses);
|
||||
|
||||
Reference in New Issue
Block a user