mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-08 05:29:36 +00:00
#164: get URL of <<tab>> ; set URL of <<tab>> to <<string>>
This commit is contained in:
parent
df1d52fe76
commit
d2acd2f2dd
|
@ -51,13 +51,16 @@ extern "C" {
|
||||||
#include "nsArrayUtils.h"
|
#include "nsArrayUtils.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
|
#include "nsNetUtil.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsIAppStartup.h"
|
#include "nsIAppStartup.h"
|
||||||
#include "nsISelection.h"
|
#include "nsISelection.h"
|
||||||
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
|
#include "nsIDOMLocation.h"
|
||||||
#include "nsIDOMSerializer.h"
|
#include "nsIDOMSerializer.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
|
@ -66,6 +69,8 @@ extern "C" {
|
||||||
#include "nsIBaseWindow.h"
|
#include "nsIBaseWindow.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsIXULWindow.h"
|
#include "nsIXULWindow.h"
|
||||||
|
#include "nsIURI.h"
|
||||||
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsIDOMWindow.h"
|
#include "nsIDOMWindow.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsIDOMWindowUtils.h"
|
#include "nsIDOMWindowUtils.h"
|
||||||
|
@ -74,6 +79,9 @@ extern "C" {
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsObjCExceptions.h"
|
#include "nsObjCExceptions.h"
|
||||||
#include "nsToolkitCompsCID.h"
|
#include "nsToolkitCompsCID.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
class nsLocation;
|
||||||
|
|
||||||
// 10.4 no haz.
|
// 10.4 no haz.
|
||||||
typedef int NSInteger;
|
typedef int NSInteger;
|
||||||
|
@ -577,39 +585,40 @@ static GeckoScriptingRoot *sharedScriptingRoot = nil;
|
||||||
return @"";
|
return @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)URL {
|
- (NSString*)URL
|
||||||
#if(0)
|
{
|
||||||
nsCOMPtr<nsIDOMWindowInternal> contentWinInternal(do_QueryInterface(mContentWindow));
|
NS_WARNING("AppleScript: tab URL");
|
||||||
if (contentWinInternal) {
|
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(mContentWindow);
|
||||||
nsCOMPtr<nsIDOMLocation> domLoc;
|
if (!piWindow)
|
||||||
if (NS_SUCCEEDED(contentWinInternal->GetLocation(getter_AddRefs(domLoc))) && domLoc) {
|
return @"";
|
||||||
nsAutoString url;
|
nsCOMPtr<nsIDocument> pdoc = piWindow->GetDoc();
|
||||||
if (NS_SUCCEEDED(domLoc->ToString(url))) {
|
if (!pdoc)
|
||||||
return [NSString stringWithUTF8String:NS_ConvertUTF16toUTF8(url).get()];
|
return @"";
|
||||||
}
|
nsCOMPtr<nsIURI> u = pdoc->GetDocumentURI();
|
||||||
}
|
if (u) {
|
||||||
|
nsAutoCString url;
|
||||||
|
u->GetAsciiSpec(url);
|
||||||
|
return [NSString stringWithUTF8String:url.get()];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return @"";
|
return @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setURL:(NSString*)newURL {
|
- (void)setURL:(NSString*)newURL
|
||||||
#if(0)
|
{
|
||||||
nsCOMPtr<nsIDOMWindowInternal> contentWinInternal(do_QueryInterface(mContentWindow));
|
NS_WARNING("AppleScript: tab newURL");
|
||||||
if (!contentWinInternal) {
|
nsAutoCString geckoURL;
|
||||||
|
nsIURI* uri;
|
||||||
|
|
||||||
|
geckoURL.Assign([newURL UTF8String]);
|
||||||
|
if (NS_FAILED(NS_NewURI(&uri, geckoURL, nullptr, nullptr, nsContentUtils::GetIOService())))
|
||||||
return;
|
return;
|
||||||
}
|
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(mContentWindow);
|
||||||
nsCOMPtr<nsIDOMLocation> domLoc;
|
if (!piWindow)
|
||||||
if (!NS_SUCCEEDED(contentWinInternal->GetLocation(getter_AddRefs(domLoc))) || !domLoc) {
|
|
||||||
return;
|
return;
|
||||||
}
|
nsCOMPtr<nsIDocShell> d = piWindow->GetDocShell();
|
||||||
nsAutoString url;
|
if (!d)
|
||||||
if (NS_SUCCEEDED(domLoc->ToString(url))) {
|
return;
|
||||||
nsCAutoString geckoURL;
|
d->LoadURI(uri, nullptr, nsIWebNavigation::LOAD_FLAGS_NONE, true);
|
||||||
geckoURL.Assign([newURL UTF8String]);
|
|
||||||
domLoc->Assign(NS_ConvertUTF8toUTF16(geckoURL));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString*)source {
|
- (NSString*)source {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user