annotate enso_pyxpcom.py @ 2:4f22928c7a2c

Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
author Atul Varma <varmaa@toolness.com>
date Thu, 08 May 2008 13:00:26 -0700
parents 6e4335fa3321
children 21f5e1dc0a4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
1 from xpcom import components, verbose
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
2 import sys, os
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
3 import logging
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
4 import platform
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
5
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
6 _ensoStarted = False
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
7
1
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
8 ENSO_PATH = os.path.join(os.getenv("HOME"), "Documents/enso-svn")
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
9 LOGGING_FILE = os.path.join(os.getenv("HOME"), "enso_pyxpcom.log")
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
10
2
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
11 def getFuelApplication():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
12 from xpcom import components
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
13 fuel_cls = components.classes["@mozilla.org/fuel/application;1"]
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
14 fuel_abs = fuel_cls.createInstance()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
15 fuel_if = components.interfaces.fuelIApplication
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
16 return fuel_abs.queryInterface(fuel_if)
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
17
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
18 def getCommandDispatcher():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
19 ci = components.interfaces
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
20 cc = components.classes
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
21
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
22 Application = getFuelApplication()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
23 document = Application.activeWindow.activeTab.document
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
24
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
25 mediator = cc["@mozilla.org/appshell/window-mediator;1"].getService(ci.nsIWindowMediator)
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
26 window = mediator.getMostRecentWindow("navigator:browser")
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
27 return window.document.commandDispatcher
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
28
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
29 def firefoxSelectionHook():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
30 import AppKit
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
31
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
32 app = AppKit.NSWorkspace.sharedWorkspace().activeApplication()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
33 if app["NSApplicationProcessIdentifier"] == os.getpid():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
34 return getFirefoxSelection()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
35 else:
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
36 from enso.platform.osx import selection
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
37
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
38 return selection._old_get()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
39
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
40 def getFirefoxSelection():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
41 text = ""
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
42 dispatcher = getCommandDispatcher()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
43
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
44 if dispatcher.focusedElement:
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
45 start = dispatcher.focusedElement.selectionStart
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
46 end = dispatcher.focusedElement.selectionEnd
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
47 if start != end:
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
48 text = dispatcher.focusedElement.value[start:end]
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
49 elif dispatcher.focusedWindow:
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
50 sel = dispatcher.focusedWindow.getSelection()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
51 if sel.rangeCount >= 1:
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
52 text = sel.toString()
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
53
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
54 return {"text" : text}
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
55
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
56 def installFirefoxSelectionHook():
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
57 from enso.platform.osx import selection
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
58
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
59 selection._old_get = selection.get
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
60 selection.get = firefoxSelectionHook
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
61
0
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
62 def getAbout():
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
63 global _ensoStarted
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
64
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
65 if not _ensoStarted:
1
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
66 logging.info("Importing Enso.")
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
67 sys.path.append(ENSO_PATH)
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
68
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
69 import enso
2
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
70
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
71 logging.info("Installing Firefox selection hook.")
4f22928c7a2c Added firefox selection context, so it's now possible to use enso in firefox (otherwise, the command-c injection wasn't working b/c I guess you can't inject events into your own process).
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
72 installFirefoxSelectionHook()
0
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
73 logging.info("Launching Enso.")
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
74 _ensoStarted = True
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
75 enso.run()
1
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
76
0
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
77 return "Enso is running."
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
78
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
79 class ShutdownObserver:
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
80 _com_interfaces_ = components.interfaces.nsIObserver
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
81
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
82 def observe(self, subject, topic, data):
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
83 print "quit-application received; calling sys.exitfunc()."
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
84 sys.exitfunc()
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
85
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
86 class AboutPython:
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
87 _com_interfaces_ = components.interfaces.nsIAboutModule
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
88 _reg_contractid_ = '@mozilla.org/network/protocol/about;1?what=enso'
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
89 _reg_clsid_ = '{6d5d462e-6de7-4bca-bbc6-c488d481351c}'
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
90 _reg_desc_ = "about:enso handler"
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
91
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
92 def __init__(self):
1
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
93 logging.basicConfig(level=logging.INFO,
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
94 filename=LOGGING_FILE,
6e4335fa3321 Fixed some things.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
95 filemode="w")
0
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
96 logging.info("Setting shutdown observer.")
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
97 observerService = components.classes["@mozilla.org/observer-service;1"].getService(components.interfaces.nsIObserverService)
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
98 observerService.addObserver(ShutdownObserver(), "quit-application", False)
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
99
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
100 def newChannel(self, aURI):
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
101 ioService = components.classes["@mozilla.org/network/io-service;1"] \
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
102 .getService();
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
103
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
104 istream = components.classes["@mozilla.org/io/string-input-stream;1"] \
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
105 .createInstance()
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
106
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
107 about = getAbout()
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
108 istream.setData(about, len(about))
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
109
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
110 channel = components.classes["@mozilla.org/network/input-stream-channel;1"] \
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
111 .createInstance(components.interfaces.nsIInputStreamChannel)
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
112
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
113 channel.setURI(aURI)
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
114 #channel.contentType = "text/html"
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
115 channel.contentStream = istream
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
116 return channel
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
117
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
118 def getURIFlags(self, aURI):
b1c0ab5d5f14 Origination, originally taken from the about:python source code from pyxpcom.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
119 return 0;