Mac:AppleScript
Jump to navigation
Jump to search
Right now Gecko is only able to respond to the relevant parts of the standard AppleScript dictionary. We'd like to expand support to allow for more complex interactions. In particular, we want to resolve the following bugs in Firefox:
- 369901, 516502, get URLs and titles for tabs
- 490830, get contents of selection
- 395712, make a new browser window
- 395711, make a new tab
Current Plan
The bug for improved AppleScript support in Gecko is bug 61356.
Discussed Options
- Proxy objects: similar to Tom Dyas' work in bug 516502, have an application create their own set of proxy Obj-C classes to respond to Applescript.
- Pros: native Obj-C solution, less chance of problems interacting with Apple's code
- Cons: must regularly update proxy objects, may not represent actual state of application. Also, much be maintained on a per-application basis (not within Gecko)
- Catching requests: override KVC and preformSelector on NSApplication subclass to catch requests from Applescript and forward requests to other classes that register with an Applescript service
- Pros: can be maintained at the Gecko-level, allows developers with no knowledge of Obj-C to provide functionality to Applescript
- Cons: could have performance implications (given changes to NSApplication), greater chance of problems interacting with Apple's code
Scripting Hierarchy
Firefox
- application
- windows
- current tab
- tabs
- index
- name
- URL
- source
- doJavascript?
- windows
Plan
The plan is...