mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-08 05:29:36 +00:00
parent
c4fac4e852
commit
64890af9bf
|
@ -295,6 +295,14 @@
|
||||||
<cocoa class="NSScriptCommand"/>
|
<cocoa class="NSScriptCommand"/>
|
||||||
<direct-parameter type="specifier" description="the object to reload"/>
|
<direct-parameter type="specifier" description="the object to reload"/>
|
||||||
</command>
|
</command>
|
||||||
|
<command name="runJS" code="104FxrJS" description="Runs JavaScript in the context of an object.">
|
||||||
|
<cocoa class="NSScriptCommand"/>
|
||||||
|
<direct-parameter type="specifier" description="the object context"/>
|
||||||
|
<parameter name="script" code="scpt" type="text" description="The script source text.">
|
||||||
|
<cocoa key="script"/>
|
||||||
|
</parameter>
|
||||||
|
<result type="text" description="String value returned by the script."/>
|
||||||
|
</command>
|
||||||
<class name="tab" code="BTab" description="A %MAC_APP_NAME% browser window tab." inherits="item" plural="tabs">
|
<class name="tab" code="BTab" description="A %MAC_APP_NAME% browser window tab." inherits="item" plural="tabs">
|
||||||
<cocoa class="GeckoTab"/>
|
<cocoa class="GeckoTab"/>
|
||||||
<property name="name" code="pnam" type="text" access="r" description="The name of the tab.">
|
<property name="name" code="pnam" type="text" access="r" description="The name of the tab.">
|
||||||
|
@ -324,6 +332,9 @@
|
||||||
<responds-to name="reload">
|
<responds-to name="reload">
|
||||||
<cocoa method="handleReloadScriptCommand:"/>
|
<cocoa method="handleReloadScriptCommand:"/>
|
||||||
</responds-to>
|
</responds-to>
|
||||||
|
<responds-to name="runJS">
|
||||||
|
<cocoa method="handleRunJavaScriptCommand:"/>
|
||||||
|
</responds-to>
|
||||||
<!--
|
<!--
|
||||||
<responds-to name="print">
|
<responds-to name="print">
|
||||||
<cocoa method="handlePrintScriptCommand:"/>
|
<cocoa method="handlePrintScriptCommand:"/>
|
||||||
|
|
|
@ -981,6 +981,7 @@ BrowserGlue.prototype = {
|
||||||
},
|
},
|
||||||
runScriptInTabAtIndexInWindow : function(index, window_index,
|
runScriptInTabAtIndexInWindow : function(index, window_index,
|
||||||
script) {
|
script) {
|
||||||
|
Services.console.logStringMessage("Got script: "+script);
|
||||||
throw Components.Exception("NYI", Cr.NS_ERROR_FAILURE);
|
throw Components.Exception("NYI", Cr.NS_ERROR_FAILURE);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1249,9 +1250,9 @@ BrowserGlue.prototype = {
|
||||||
this._resetUnusedProfileNotification();
|
this._resetUnusedProfileNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._checkForOldBuildUpdates();
|
//this._checkForOldBuildUpdates();
|
||||||
|
|
||||||
this._firstWindowTelemetry(aWindow);
|
//this._firstWindowTelemetry(aWindow);
|
||||||
this._firstWindowLoaded();
|
this._firstWindowLoaded();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1337,8 +1338,8 @@ BrowserGlue.prototype = {
|
||||||
|
|
||||||
// If there are plugins installed that are outdated, and the user hasn't
|
// If there are plugins installed that are outdated, and the user hasn't
|
||||||
// been warned about them yet, open the plugins update page.
|
// been warned about them yet, open the plugins update page.
|
||||||
if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
//if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
||||||
this._showPluginUpdatePage();
|
// this._showPluginUpdatePage();
|
||||||
|
|
||||||
// For any add-ons that were installed disabled and can be enabled offer
|
// For any add-ons that were installed disabled and can be enabled offer
|
||||||
// them to the user.
|
// them to the user.
|
||||||
|
|
|
@ -182,6 +182,7 @@ typedef unsigned int NSUInteger;
|
||||||
|
|
||||||
- (id)handleCloseScriptCommand:(NSCloseCommand*)command;
|
- (id)handleCloseScriptCommand:(NSCloseCommand*)command;
|
||||||
- (id)handleReloadScriptCommand:(NSScriptCommand*)command;
|
- (id)handleReloadScriptCommand:(NSScriptCommand*)command;
|
||||||
|
- (NSString*)handleRunJavaScriptCommand:(NSScriptCommand*)command;
|
||||||
|
|
||||||
// Helper Methods
|
// Helper Methods
|
||||||
- (void)_setWindow:(GeckoWindow*)window;
|
- (void)_setWindow:(GeckoWindow*)window;
|
||||||
|
@ -757,7 +758,7 @@ static BOOL didInit = NO;
|
||||||
geckoURL.Assign([newURL UTF8String]);
|
geckoURL.Assign([newURL UTF8String]);
|
||||||
if (NS_FAILED(NS_NewURI(&uri, geckoURL, nullptr, nullptr, nsContentUtils::GetIOService()))) {
|
if (NS_FAILED(NS_NewURI(&uri, geckoURL, nullptr, nullptr, nsContentUtils::GetIOService()))) {
|
||||||
if (c) {
|
if (c) {
|
||||||
[c setScriptErrorNumber:-1700]; // errAECoercionFail
|
[c setScriptErrorNumber:-2131]; // urlDataHHTTPURLErr
|
||||||
[c setScriptErrorString:@"Parameter Error: URL is not valid."];
|
[c setScriptErrorString:@"Parameter Error: URL is not valid."];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -883,6 +884,32 @@ static BOOL didInit = NO;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString*)handleRunJavaScriptCommand:(NSScriptCommand*)command {
|
||||||
|
nsCOMPtr<nsIApplescriptService> applescriptService(do_GetService("@mozilla.org/applescript-service;1"));
|
||||||
|
if (applescriptService) {
|
||||||
|
NSDictionary *args = [command evaluatedArguments];
|
||||||
|
if (args) {
|
||||||
|
NSString *script = [args objectForKey:@"script"];
|
||||||
|
if (script) {
|
||||||
|
nsAutoCString s, r;
|
||||||
|
bool ok;
|
||||||
|
|
||||||
|
s.Assign([script UTF8String]);
|
||||||
|
if (NS_SUCCEEDED(applescriptService->RunScriptInTabAtIndexInWindow(mIndex,
|
||||||
|
[mWindow orderedIndex],
|
||||||
|
s, r, &ok))) {
|
||||||
|
if (ok)
|
||||||
|
return [NSString stringWithUTF8String:r.get()];
|
||||||
|
|
||||||
|
[command setScriptErrorNumber:-2740]; // OSASyntaxError
|
||||||
|
[command setScriptErrorString:@"Parameter Error: Failed to run JavaScript."]; // XXX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
Loading…
Reference in New Issue
Block a user