From 507095d637e0ba0ffa4b46681307e2db8da00365 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Fri, 21 May 2004 09:19:08 +0000 Subject: [PATCH] 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 --- .../content/mailNavigatorOverlay.xul | 22 +++++++++---------- .../browser/resources/content/navigator.js | 12 +++++----- .../content/contentAreaContextOverlay.xul | 1 + .../resources/content/contentAreaUtils.js | 5 ++--- .../resources/content/nsContextMenu.js | 10 ++++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/mozilla/xpfe/browser/resources/content/mailNavigatorOverlay.xul b/mozilla/xpfe/browser/resources/content/mailNavigatorOverlay.xul index 1fbd3d36c22..7d44532d9f2 100644 --- a/mozilla/xpfe/browser/resources/content/mailNavigatorOverlay.xul +++ b/mozilla/xpfe/browser/resources/content/mailNavigatorOverlay.xul @@ -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 @@ - + @@ -227,7 +227,7 @@ + oncommand="sendPage(new XPCNativeWrapper(gContextMenu.target, 'ownerDocument').ownerDocument);"/> diff --git a/mozilla/xpfe/browser/resources/content/navigator.js b/mozilla/xpfe/browser/resources/content/navigator.js index c16f4320137..d1c87e704c0 100644 --- a/mozilla/xpfe/browser/resources/content/navigator.js +++ b/mozilla/xpfe/browser/resources/content/navigator.js @@ -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) { } diff --git a/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul b/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul index b2319301bbb..c78563afb25 100644 --- a/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul +++ b/mozilla/xpfe/communicator/resources/content/contentAreaContextOverlay.xul @@ -52,6 +52,7 @@