ogre.rb 0.1-i686-linux → 0.2-i686-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/README +43 -5
- data/Rakefile +67 -165
- data/lib/application.rb +2 -1
- data/lib/application_frame_listener.rb +17 -17
- data/lib/ogre.so +0 -0
- data/lib/ruby_ois.so +0 -0
- data/ogre.rb +3 -0
- data/samples/Ogre.log +358 -257
- data/samples/cel_shading.rb +85 -0
- data/samples/grass.rb +1 -1
- data/samples/media/materials/programs/CelShading.cg +63 -0
- data/samples/media/materials/scripts/CelShading.material +68 -0
- data/samples/media/materials/textures/cel_shading_diffuse.png +0 -0
- data/samples/media/materials/textures/cel_shading_edge.png +0 -0
- data/samples/media/materials/textures/cel_shading_specular.png +0 -0
- data/samples/ogre.cfg +1 -2
- data/samples/plugins.cfg +3 -2
- data/test/ogre.cfg +10 -0
- data/{samples/navi → test}/plugins.cfg +2 -4
- data/test/test_helper.rb +67 -0
- data/test/unit/constants_test.rb +66 -0
- data/test/unit/frame_stats_proxy_test.rb +28 -0
- data/test/unit/math_test.rb +20 -0
- data/test/unit/mesh_test.rb +15 -0
- data/test/unit/methods_test.rb +98 -0
- data/test/unit/movable_object_test.rb +19 -0
- data/test/unit/name_value_pair_list_test.rb +12 -0
- data/test/unit/overlay_element_test.rb +20 -0
- data/test/unit/render_target_test.rb +11 -0
- data/test/unit/resource_test.rb +26 -0
- data/test/unit/scene_manager_test.rb +21 -0
- metadata +25 -356
- data/samples/navi/Media/NaviDemo.material +0 -60
- data/samples/navi/Media/OgreCore.zip +0 -0
- data/samples/navi/Media/cerulean.jpg +0 -0
- data/samples/navi/Media/clouds.jpg +0 -0
- data/samples/navi/Media/controlsNaviMask.png +0 -0
- data/samples/navi/Media/grass.jpg +0 -0
- data/samples/navi/Media/knot.mesh +0 -0
- data/samples/navi/Media/testNaviMask.png +0 -0
- data/samples/navi/NaviLocal/Navi.js +0 -136
- data/samples/navi/NaviLocal/buttonBg.jpg +0 -0
- data/samples/navi/NaviLocal/controls.html +0 -303
- data/samples/navi/NaviLocal/knobBg.jpg +0 -0
- data/samples/navi/NaviLocal/moo.dropdownmenu.js +0 -87
- data/samples/navi/NaviLocal/mootools.v1.1.js +0 -6964
- data/samples/navi/NaviLocal/naviLogo.html +0 -32
- data/samples/navi/NaviLocal/naviLogo.png +0 -0
- data/samples/navi/NaviLocal/pageBg.jpg +0 -0
- data/samples/navi/NaviLocal/sliderBg.jpg +0 -0
- data/samples/navi/NaviLocal/test.html +0 -5
- data/samples/navi/NaviLocal/welcome.html +0 -36
- data/samples/navi/NaviLocal/welcome.png +0 -0
- data/samples/navi/chrome/chromelist.txt +0 -597
- data/samples/navi/chrome/classic.jar +0 -0
- data/samples/navi/chrome/classic.manifest +0 -4
- data/samples/navi/chrome/comm.jar +0 -0
- data/samples/navi/chrome/comm.manifest +0 -2
- data/samples/navi/chrome/en-US.jar +0 -0
- data/samples/navi/chrome/en-US.manifest +0 -9
- data/samples/navi/chrome/toolkit.jar +0 -0
- data/samples/navi/chrome/toolkit.manifest +0 -6
- data/samples/navi/components/FeedProcessor.js +0 -1825
- data/samples/navi/components/alerts.xpt +0 -0
- data/samples/navi/components/appshell.xpt +0 -0
- data/samples/navi/components/appstartup.xpt +0 -0
- data/samples/navi/components/auth.dll +0 -0
- data/samples/navi/components/autocomplete.xpt +0 -0
- data/samples/navi/components/autoconfig.dll +0 -0
- data/samples/navi/components/autoconfig.xpt +0 -0
- data/samples/navi/components/caps.xpt +0 -0
- data/samples/navi/components/chardet.xpt +0 -0
- data/samples/navi/components/chrome.xpt +0 -0
- data/samples/navi/components/commandhandler.xpt +0 -0
- data/samples/navi/components/commandlines.xpt +0 -0
- data/samples/navi/components/composer.xpt +0 -0
- data/samples/navi/components/compreg.dat +0 -1474
- data/samples/navi/components/content_base.xpt +0 -0
- data/samples/navi/components/content_html.xpt +0 -0
- data/samples/navi/components/content_htmldoc.xpt +0 -0
- data/samples/navi/components/content_xmldoc.xpt +0 -0
- data/samples/navi/components/content_xslt.xpt +0 -0
- data/samples/navi/components/content_xtf.xpt +0 -0
- data/samples/navi/components/directory.xpt +0 -0
- data/samples/navi/components/docshell_base.xpt +0 -0
- data/samples/navi/components/dom.xpt +0 -0
- data/samples/navi/components/dom_base.xpt +0 -0
- data/samples/navi/components/dom_canvas.xpt +0 -0
- data/samples/navi/components/dom_core.xpt +0 -0
- data/samples/navi/components/dom_css.xpt +0 -0
- data/samples/navi/components/dom_events.xpt +0 -0
- data/samples/navi/components/dom_html.xpt +0 -0
- data/samples/navi/components/dom_loadsave.xpt +0 -0
- data/samples/navi/components/dom_range.xpt +0 -0
- data/samples/navi/components/dom_sidebar.xpt +0 -0
- data/samples/navi/components/dom_storage.xpt +0 -0
- data/samples/navi/components/dom_stylesheets.xpt +0 -0
- data/samples/navi/components/dom_svg.xpt +0 -0
- data/samples/navi/components/dom_traversal.xpt +0 -0
- data/samples/navi/components/dom_views.xpt +0 -0
- data/samples/navi/components/dom_xbl.xpt +0 -0
- data/samples/navi/components/dom_xpath.xpt +0 -0
- data/samples/navi/components/dom_xul.xpt +0 -0
- data/samples/navi/components/downloads.xpt +0 -0
- data/samples/navi/components/editor.xpt +0 -0
- data/samples/navi/components/embed_base.xpt +0 -0
- data/samples/navi/components/extensions.xpt +0 -0
- data/samples/navi/components/exthandler.xpt +0 -0
- data/samples/navi/components/fastfind.xpt +0 -0
- data/samples/navi/components/feeds.xpt +0 -0
- data/samples/navi/components/find.xpt +0 -0
- data/samples/navi/components/gfx.xpt +0 -0
- data/samples/navi/components/gksvgrenderer.xpt +0 -0
- data/samples/navi/components/history.xpt +0 -0
- data/samples/navi/components/htmlparser.xpt +0 -0
- data/samples/navi/components/imglib2.xpt +0 -0
- data/samples/navi/components/inspector.xpt +0 -0
- data/samples/navi/components/intl.xpt +0 -0
- data/samples/navi/components/intlcmpt.xpt +0 -0
- data/samples/navi/components/jar.xpt +0 -0
- data/samples/navi/components/jsconsole-clhandler.js +0 -170
- data/samples/navi/components/jsconsole.xpt +0 -0
- data/samples/navi/components/jsdservice.xpt +0 -0
- data/samples/navi/components/layout_base.xpt +0 -0
- data/samples/navi/components/layout_printing.xpt +0 -0
- data/samples/navi/components/layout_xul.xpt +0 -0
- data/samples/navi/components/layout_xul_tree.xpt +0 -0
- data/samples/navi/components/locale.xpt +0 -0
- data/samples/navi/components/lwbrk.xpt +0 -0
- data/samples/navi/components/mimetype.xpt +0 -0
- data/samples/navi/components/mozbrwsr.xpt +0 -0
- data/samples/navi/components/mozfind.xpt +0 -0
- data/samples/navi/components/necko.xpt +0 -0
- data/samples/navi/components/necko_about.xpt +0 -0
- data/samples/navi/components/necko_cache.xpt +0 -0
- data/samples/navi/components/necko_cookie.xpt +0 -0
- data/samples/navi/components/necko_data.xpt +0 -0
- data/samples/navi/components/necko_dns.xpt +0 -0
- data/samples/navi/components/necko_file.xpt +0 -0
- data/samples/navi/components/necko_ftp.xpt +0 -0
- data/samples/navi/components/necko_http.xpt +0 -0
- data/samples/navi/components/necko_res.xpt +0 -0
- data/samples/navi/components/necko_socket.xpt +0 -0
- data/samples/navi/components/necko_strconv.xpt +0 -0
- data/samples/navi/components/necko_viewsource.xpt +0 -0
- data/samples/navi/components/nsCloseAllWindows.js +0 -143
- data/samples/navi/components/nsDefaultCLH.js +0 -231
- data/samples/navi/components/nsDictionary.js +0 -148
- data/samples/navi/components/nsExtensionManager.js +0 -8497
- data/samples/navi/components/nsHelperAppDlg.js +0 -990
- data/samples/navi/components/nsInterfaceInfoToIDL.js +0 -590
- data/samples/navi/components/nsKillAll.js +0 -200
- data/samples/navi/components/nsPostUpdateWin.js +0 -711
- data/samples/navi/components/nsProgressDialog.js +0 -949
- data/samples/navi/components/nsProxyAutoConfig.js +0 -396
- data/samples/navi/components/nsResetPref.js +0 -175
- data/samples/navi/components/nsURLFormatter.js +0 -179
- data/samples/navi/components/nsUpdateService.js +0 -3074
- data/samples/navi/components/nsXULAppInstall.js +0 -301
- data/samples/navi/components/nsXmlRpcClient.js +0 -1038
- data/samples/navi/components/oji.xpt +0 -0
- data/samples/navi/components/passwordmgr.xpt +0 -0
- data/samples/navi/components/pipboot.xpt +0 -0
- data/samples/navi/components/pipnss.xpt +0 -0
- data/samples/navi/components/plugin.xpt +0 -0
- data/samples/navi/components/pref.xpt +0 -0
- data/samples/navi/components/prefetch.xpt +0 -0
- data/samples/navi/components/profile.xpt +0 -0
- data/samples/navi/components/progressDlg.xpt +0 -0
- data/samples/navi/components/proxyObject.xpt +0 -0
- data/samples/navi/components/rdf.xpt +0 -0
- data/samples/navi/components/satchel.xpt +0 -0
- data/samples/navi/components/saxparser.xpt +0 -0
- data/samples/navi/components/shistory.xpt +0 -0
- data/samples/navi/components/storage.xpt +0 -0
- data/samples/navi/components/toolkitprofile.xpt +0 -0
- data/samples/navi/components/transformiix.dll +0 -0
- data/samples/navi/components/txmgr.xpt +0 -0
- data/samples/navi/components/txtsvc.xpt +0 -0
- data/samples/navi/components/uconv.xpt +0 -0
- data/samples/navi/components/unicharutil.xpt +0 -0
- data/samples/navi/components/universalchardet.dll +0 -0
- data/samples/navi/components/update.xpt +0 -0
- data/samples/navi/components/uriloader.xpt +0 -0
- data/samples/navi/components/urlformatter.xpt +0 -0
- data/samples/navi/components/webBrowser_core.xpt +0 -0
- data/samples/navi/components/webbrowserpersist.xpt +0 -0
- data/samples/navi/components/webshell_idls.xpt +0 -0
- data/samples/navi/components/websrvcs.dll +0 -0
- data/samples/navi/components/websrvcs.xpt +0 -0
- data/samples/navi/components/widget.xpt +0 -0
- data/samples/navi/components/windowds.xpt +0 -0
- data/samples/navi/components/windowwatcher.xpt +0 -0
- data/samples/navi/components/xml-rpc.xpt +0 -0
- data/samples/navi/components/xmlextras.dll +0 -0
- data/samples/navi/components/xpcom_base.xpt +0 -0
- data/samples/navi/components/xpcom_components.xpt +0 -0
- data/samples/navi/components/xpcom_ds.xpt +0 -0
- data/samples/navi/components/xpcom_io.xpt +0 -0
- data/samples/navi/components/xpcom_obsolete.xpt +0 -0
- data/samples/navi/components/xpcom_thread.xpt +0 -0
- data/samples/navi/components/xpcom_xpti.xpt +0 -0
- data/samples/navi/components/xpconnect.xpt +0 -0
- data/samples/navi/components/xpinstall.xpt +0 -0
- data/samples/navi/components/xpti.dat +0 -1424
- data/samples/navi/components/xulapp.xpt +0 -0
- data/samples/navi/components/xulapp_setup.xpt +0 -0
- data/samples/navi/components/xuldoc.xpt +0 -0
- data/samples/navi/components/xulrunner.xpt +0 -0
- data/samples/navi/components/xultmpl.xpt +0 -0
- data/samples/navi/components/xulutil.dll +0 -0
- data/samples/navi/controlsNaviMask.png +0 -0
- data/samples/navi/greprefs/all.js +0 -1344
- data/samples/navi/greprefs/security-prefs.js +0 -69
- data/samples/navi/greprefs/xpinstall.js +0 -2
- data/samples/navi/navi_demo.rb +0 -207
- data/samples/navi/plugins/NPSWF32.dll +0 -0
- data/samples/navi/plugins/flashplayer.xpt +0 -0
- data/samples/navi/plugins/npnul32.dll +0 -0
- data/samples/navi/res/EditorOverride.css +0 -359
- data/samples/navi/res/Thumbs.db +0 -0
- data/samples/navi/res/arrow.gif +0 -0
- data/samples/navi/res/arrowd.gif +0 -0
- data/samples/navi/res/bloatcycle.html +0 -40
- data/samples/navi/res/broken-image.gif +0 -0
- data/samples/navi/res/charsetData.properties +0 -199
- data/samples/navi/res/charsetalias.properties +0 -517
- data/samples/navi/res/cmessage.txt +0 -1
- data/samples/navi/res/dtd/xhtml11.dtd +0 -300
- data/samples/navi/res/entityTables/html40Latin1.properties +0 -146
- data/samples/navi/res/entityTables/html40Special.properties +0 -69
- data/samples/navi/res/entityTables/html40Symbols.properties +0 -164
- data/samples/navi/res/entityTables/htmlEntityVersions.properties +0 -50
- data/samples/navi/res/entityTables/transliterate.properties +0 -2367
- data/samples/navi/res/fonts/fontEncoding.properties +0 -127
- data/samples/navi/res/fonts/fontNameMap.properties +0 -134
- data/samples/navi/res/forms.css +0 -531
- data/samples/navi/res/grabber.gif +0 -0
- data/samples/navi/res/hiddenWindow.html +0 -1
- data/samples/navi/res/html/Thumbs.db +0 -0
- data/samples/navi/res/html/gopher-audio.gif +0 -0
- data/samples/navi/res/html/gopher-binary.gif +0 -0
- data/samples/navi/res/html/gopher-find.gif +0 -0
- data/samples/navi/res/html/gopher-image.gif +0 -0
- data/samples/navi/res/html/gopher-menu.gif +0 -0
- data/samples/navi/res/html/gopher-movie.gif +0 -0
- data/samples/navi/res/html/gopher-sound.gif +0 -0
- data/samples/navi/res/html/gopher-telnet.gif +0 -0
- data/samples/navi/res/html/gopher-text.gif +0 -0
- data/samples/navi/res/html/gopher-unknown.gif +0 -0
- data/samples/navi/res/html.css +0 -478
- data/samples/navi/res/langGroups.properties +0 -236
- data/samples/navi/res/language.properties +0 -259
- data/samples/navi/res/loading-image.gif +0 -0
- data/samples/navi/res/quirk.css +0 -282
- data/samples/navi/res/samples/Anieyes.gif +0 -0
- data/samples/navi/res/samples/Thumbs.db +0 -0
- data/samples/navi/res/samples/aform.css +0 -69
- data/samples/navi/res/samples/beeptest.html +0 -18
- data/samples/navi/res/samples/bform.css +0 -45
- data/samples/navi/res/samples/bg.jpg +0 -0
- data/samples/navi/res/samples/cform.css +0 -40
- data/samples/navi/res/samples/checkboxTest.xul +0 -47
- data/samples/navi/res/samples/demoform.css +0 -97
- data/samples/navi/res/samples/find.html +0 -97
- data/samples/navi/res/samples/gear1.gif +0 -0
- data/samples/navi/res/samples/image_props.html +0 -58
- data/samples/navi/res/samples/mozform.css +0 -256
- data/samples/navi/res/samples/printsetup.html +0 -175
- data/samples/navi/res/samples/raptor.jpg +0 -0
- data/samples/navi/res/samples/rock_gra.gif +0 -0
- data/samples/navi/res/samples/scrollbarTest1.xul +0 -66
- data/samples/navi/res/samples/scrollbarTest2.xul +0 -19
- data/samples/navi/res/samples/sliderTest1.xul +0 -14
- data/samples/navi/res/samples/soundtest.html +0 -20
- data/samples/navi/res/samples/test.wav +0 -0
- data/samples/navi/res/samples/test0.html +0 -220
- data/samples/navi/res/samples/test1.html +0 -84
- data/samples/navi/res/samples/test10.html +0 -16
- data/samples/navi/res/samples/test11.html +0 -42
- data/samples/navi/res/samples/test12.html +0 -79
- data/samples/navi/res/samples/test13.html +0 -126
- data/samples/navi/res/samples/test14.html +0 -5
- data/samples/navi/res/samples/test15.html +0 -5
- data/samples/navi/res/samples/test16.html +0 -124
- data/samples/navi/res/samples/test2.html +0 -41
- data/samples/navi/res/samples/test3.html +0 -126
- data/samples/navi/res/samples/test4.html +0 -335
- data/samples/navi/res/samples/test5.html +0 -199
- data/samples/navi/res/samples/test6.html +0 -335
- data/samples/navi/res/samples/test7.html +0 -11
- data/samples/navi/res/samples/test8-1.html +0 -66
- data/samples/navi/res/samples/test8.html +0 -662
- data/samples/navi/res/samples/test8dom.html +0 -64
- data/samples/navi/res/samples/test8sca.html +0 -308
- data/samples/navi/res/samples/test8siz.html +0 -224
- data/samples/navi/res/samples/test8tab.html +0 -9
- data/samples/navi/res/samples/test9.html +0 -12
- data/samples/navi/res/samples/test9a.html +0 -39
- data/samples/navi/res/samples/test9b.html +0 -16
- data/samples/navi/res/samples/test_ed.html +0 -5
- data/samples/navi/res/samples/test_form.html +0 -34
- data/samples/navi/res/samples/test_gfx.html +0 -75
- data/samples/navi/res/samples/test_lbox.html +0 -100
- data/samples/navi/res/samples/test_pr.html +0 -87
- data/samples/navi/res/samples/test_weight.html +0 -45
- data/samples/navi/res/samples/toolbarTest1.xul +0 -51
- data/samples/navi/res/samples/treeTest1.css +0 -62
- data/samples/navi/res/samples/treeTest1.xul +0 -110
- data/samples/navi/res/samples/xulTest.css +0 -130
- data/samples/navi/res/svg.css +0 -64
- data/samples/navi/res/table-add-column-after-active.gif +0 -0
- data/samples/navi/res/table-add-column-after-hover.gif +0 -0
- data/samples/navi/res/table-add-column-after.gif +0 -0
- data/samples/navi/res/table-add-column-before-active.gif +0 -0
- data/samples/navi/res/table-add-column-before-hover.gif +0 -0
- data/samples/navi/res/table-add-column-before.gif +0 -0
- data/samples/navi/res/table-add-row-after-active.gif +0 -0
- data/samples/navi/res/table-add-row-after-hover.gif +0 -0
- data/samples/navi/res/table-add-row-after.gif +0 -0
- data/samples/navi/res/table-add-row-before-active.gif +0 -0
- data/samples/navi/res/table-add-row-before-hover.gif +0 -0
- data/samples/navi/res/table-add-row-before.gif +0 -0
- data/samples/navi/res/table-remove-column-active.gif +0 -0
- data/samples/navi/res/table-remove-column-hover.gif +0 -0
- data/samples/navi/res/table-remove-column.gif +0 -0
- data/samples/navi/res/table-remove-row-active.gif +0 -0
- data/samples/navi/res/table-remove-row-hover.gif +0 -0
- data/samples/navi/res/table-remove-row.gif +0 -0
- data/samples/navi/res/throbber/Thumbs.db +0 -0
- data/samples/navi/res/throbber/anim.gif +0 -0
- data/samples/navi/res/throbber/anims00.gif +0 -0
- data/samples/navi/res/throbber/anims01.gif +0 -0
- data/samples/navi/res/throbber/anims02.gif +0 -0
- data/samples/navi/res/throbber/anims03.gif +0 -0
- data/samples/navi/res/throbber/anims04.gif +0 -0
- data/samples/navi/res/throbber/anims05.gif +0 -0
- data/samples/navi/res/throbber/anims06.gif +0 -0
- data/samples/navi/res/throbber/anims07.gif +0 -0
- data/samples/navi/res/throbber/anims08.gif +0 -0
- data/samples/navi/res/throbber/anims09.gif +0 -0
- data/samples/navi/res/throbber/anims10.gif +0 -0
- data/samples/navi/res/throbber/anims11.gif +0 -0
- data/samples/navi/res/throbber/anims12.gif +0 -0
- data/samples/navi/res/throbber/anims13.gif +0 -0
- data/samples/navi/res/throbber/anims14.gif +0 -0
- data/samples/navi/res/throbber/anims15.gif +0 -0
- data/samples/navi/res/throbber/anims16.gif +0 -0
- data/samples/navi/res/throbber/anims17.gif +0 -0
- data/samples/navi/res/throbber/anims18.gif +0 -0
- data/samples/navi/res/throbber/anims19.gif +0 -0
- data/samples/navi/res/throbber/anims20.gif +0 -0
- data/samples/navi/res/throbber/anims21.gif +0 -0
- data/samples/navi/res/throbber/anims22.gif +0 -0
- data/samples/navi/res/throbber/anims23.gif +0 -0
- data/samples/navi/res/throbber/anims24.gif +0 -0
- data/samples/navi/res/throbber/anims25.gif +0 -0
- data/samples/navi/res/throbber/anims26.gif +0 -0
- data/samples/navi/res/throbber/anims27.gif +0 -0
- data/samples/navi/res/throbber/anims28.gif +0 -0
- data/samples/navi/res/throbber/anims29.gif +0 -0
- data/samples/navi/res/ua.css +0 -235
- data/samples/navi/res/viewer.properties +0 -1
- data/samples/navi/res/viewsource.css +0 -118
- data/samples/navi/res/wincharset.properties +0 -55
- data/samples/navi/resources.cfg +0 -14
- data/samples/navi/testNaviMask.png +0 -0
- data/samples/render_run_log.5796 +0 -891
@@ -1,396 +0,0 @@
|
|
1
|
-
/* -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*- */
|
2
|
-
/* vim:set ts=4 sw=4 sts=4 et: */
|
3
|
-
/* ***** BEGIN LICENSE BLOCK *****
|
4
|
-
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
5
|
-
*
|
6
|
-
* The contents of this file are subject to the Mozilla Public License Version
|
7
|
-
* 1.1 (the "License"); you may not use this file except in compliance with
|
8
|
-
* the License. You may obtain a copy of the License at
|
9
|
-
* http://www.mozilla.org/MPL/
|
10
|
-
*
|
11
|
-
* Software distributed under the License is distributed on an "AS IS" basis,
|
12
|
-
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
13
|
-
* for the specific language governing rights and limitations under the
|
14
|
-
* License.
|
15
|
-
*
|
16
|
-
* The Original Code is mozilla.org code.
|
17
|
-
*
|
18
|
-
* The Initial Developer of the Original Code is
|
19
|
-
* Netscape Communications Corporation.
|
20
|
-
* Portions created by the Initial Developer are Copyright (C) 1998
|
21
|
-
* the Initial Developer. All Rights Reserved.
|
22
|
-
*
|
23
|
-
* Contributor(s):
|
24
|
-
* Akhil Arora <akhil.arora@sun.com>
|
25
|
-
* Tomi Leppikangas <Tomi.Leppikangas@oulu.fi>
|
26
|
-
* Darin Fisher <darin@meer.net>
|
27
|
-
*
|
28
|
-
* Alternatively, the contents of this file may be used under the terms of
|
29
|
-
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
30
|
-
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
31
|
-
* in which case the provisions of the GPL or the LGPL are applicable instead
|
32
|
-
* of those above. If you wish to allow use of your version of this file only
|
33
|
-
* under the terms of either the GPL or the LGPL, and not to allow others to
|
34
|
-
* use your version of this file under the terms of the MPL, indicate your
|
35
|
-
* decision by deleting the provisions above and replace them with the notice
|
36
|
-
* and other provisions required by the GPL or the LGPL. If you do not delete
|
37
|
-
* the provisions above, a recipient may use your version of this file under
|
38
|
-
* the terms of any one of the MPL, the GPL or the LGPL.
|
39
|
-
*
|
40
|
-
* ***** END LICENSE BLOCK ***** */
|
41
|
-
|
42
|
-
/*
|
43
|
-
Script for Proxy Auto Config in the new world order.
|
44
|
-
- Gagan Saksena 04/24/00
|
45
|
-
*/
|
46
|
-
|
47
|
-
const kDNS_CONTRACTID = "@mozilla.org/network/dns-service;1";
|
48
|
-
const kPAC_CONTRACTID = "@mozilla.org/network/proxy-auto-config;1";
|
49
|
-
const kPAC_CID = Components.ID("{63ac8c66-1dd2-11b2-b070-84d00d3eaece}");
|
50
|
-
|
51
|
-
const nsISupports = Components.interfaces.nsISupports;
|
52
|
-
const nsIProxyAutoConfig = Components.interfaces.nsIProxyAutoConfig;
|
53
|
-
const nsIDNSService = Components.interfaces.nsIDNSService;
|
54
|
-
|
55
|
-
// implementor of nsIProxyAutoConfig
|
56
|
-
function nsProxyAutoConfig() {};
|
57
|
-
|
58
|
-
nsProxyAutoConfig.prototype = {
|
59
|
-
// sandbox in which we eval loaded autoconfig js file
|
60
|
-
_sandBox: null,
|
61
|
-
|
62
|
-
// ptr to eval'ed FindProxyForURL function
|
63
|
-
_findProxyForURL: null,
|
64
|
-
|
65
|
-
QueryInterface: function(iid) {
|
66
|
-
if (iid.Equals(nsIProxyAutoConfig) ||
|
67
|
-
iid.Equals(nsISupports))
|
68
|
-
return this;
|
69
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
70
|
-
},
|
71
|
-
|
72
|
-
init: function(pacURI, pacText) {
|
73
|
-
// remove PAC configuration if requested
|
74
|
-
if (pacURI == "" || pacText == "") {
|
75
|
-
this._findProxyForURL = null;
|
76
|
-
this._sandBox = null;
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
|
80
|
-
// allocate a fresh Sandbox to clear global scope for new PAC script
|
81
|
-
this._sandBox = new Components.utils.Sandbox(pacURI);
|
82
|
-
Components.utils.evalInSandbox(pacUtils, this._sandBox);
|
83
|
-
|
84
|
-
// add predefined functions to pac
|
85
|
-
this._sandBox.importFunction(myIpAddress);
|
86
|
-
this._sandBox.importFunction(dnsResolve);
|
87
|
-
this._sandBox.importFunction(proxyAlert, "alert");
|
88
|
-
|
89
|
-
// evaluate loaded js file
|
90
|
-
Components.utils.evalInSandbox(pacText, this._sandBox);
|
91
|
-
this._findProxyForURL = this._sandBox.FindProxyForURL;
|
92
|
-
},
|
93
|
-
|
94
|
-
getProxyForURI: function(testURI, testHost) {
|
95
|
-
if (!this._findProxyForURL)
|
96
|
-
return null;
|
97
|
-
|
98
|
-
// Call the original function
|
99
|
-
return this._findProxyForURL.call(this._sandBox, testURI, testHost);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
|
103
|
-
function proxyAlert(msg) {
|
104
|
-
try {
|
105
|
-
// It would appear that the console service is threadsafe.
|
106
|
-
var cns = Components.classes["@mozilla.org/consoleservice;1"]
|
107
|
-
.getService(Components.interfaces.nsIConsoleService);
|
108
|
-
cns.logStringMessage("PAC-alert: "+msg);
|
109
|
-
} catch (e) {
|
110
|
-
dump("PAC: proxyAlert ERROR: "+e+"\n");
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
|
-
// wrapper for getting local IP address called by PAC file
|
115
|
-
function myIpAddress() {
|
116
|
-
try {
|
117
|
-
return dns.resolve(dns.myHostName, 0).getNextAddrAsString();
|
118
|
-
} catch (e) {
|
119
|
-
return '127.0.0.1';
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
// wrapper for resolving hostnames called by PAC file
|
124
|
-
function dnsResolve(host) {
|
125
|
-
try {
|
126
|
-
return dns.resolve(host, 0).getNextAddrAsString();
|
127
|
-
} catch (e) {
|
128
|
-
return null;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
var pacModule = new Object();
|
133
|
-
|
134
|
-
pacModule.registerSelf =
|
135
|
-
function (compMgr, fileSpec, location, type) {
|
136
|
-
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
137
|
-
compMgr.registerFactoryLocation(kPAC_CID,
|
138
|
-
"nsProxyAutoConfig",
|
139
|
-
kPAC_CONTRACTID,
|
140
|
-
fileSpec,
|
141
|
-
location,
|
142
|
-
type);
|
143
|
-
}
|
144
|
-
|
145
|
-
pacModule.getClassObject =
|
146
|
-
function (compMgr, cid, iid) {
|
147
|
-
if (!cid.equals(kPAC_CID))
|
148
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
149
|
-
|
150
|
-
if (!iid.equals(Components.interfaces.nsIFactory))
|
151
|
-
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
152
|
-
|
153
|
-
return pacFactory;
|
154
|
-
}
|
155
|
-
|
156
|
-
pacModule.canUnload =
|
157
|
-
function (compMgr) {
|
158
|
-
return true;
|
159
|
-
}
|
160
|
-
|
161
|
-
var pacFactory = new Object();
|
162
|
-
pacFactory.createInstance =
|
163
|
-
function (outer, iid) {
|
164
|
-
if (outer != null)
|
165
|
-
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
166
|
-
|
167
|
-
if (!iid.equals(nsIProxyAutoConfig) &&
|
168
|
-
!iid.equals(Components.interfaces.nsISupports)) {
|
169
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
170
|
-
}
|
171
|
-
return pac;
|
172
|
-
}
|
173
|
-
|
174
|
-
function NSGetModule(compMgr, fileSpec) {
|
175
|
-
return pacModule;
|
176
|
-
}
|
177
|
-
|
178
|
-
var pac = new nsProxyAutoConfig() ;
|
179
|
-
var dns = Components.classes[kDNS_CONTRACTID].getService(nsIDNSService);
|
180
|
-
|
181
|
-
var pacUtils =
|
182
|
-
"function dnsDomainIs(host, domain) {\n" +
|
183
|
-
" return (host.length >= domain.length &&\n" +
|
184
|
-
" host.substring(host.length - domain.length) == domain);\n" +
|
185
|
-
"}\n" +
|
186
|
-
|
187
|
-
"function dnsDomainLevels(host) {\n" +
|
188
|
-
" return host.split('.').length-1;\n" +
|
189
|
-
"}\n" +
|
190
|
-
|
191
|
-
"function convert_addr(ipchars) {\n"+
|
192
|
-
" var bytes = ipchars.split('.');\n"+
|
193
|
-
" var result = ((bytes[0] & 0xff) << 24) |\n"+
|
194
|
-
" ((bytes[1] & 0xff) << 16) |\n"+
|
195
|
-
" ((bytes[2] & 0xff) << 8) |\n"+
|
196
|
-
" (bytes[3] & 0xff);\n"+
|
197
|
-
" return result;\n"+
|
198
|
-
"}\n"+
|
199
|
-
|
200
|
-
"function isInNet(ipaddr, pattern, maskstr) {\n"+
|
201
|
-
" var test = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/(ipaddr);\n"+
|
202
|
-
" if (test == null) {\n"+
|
203
|
-
" ipaddr = dnsResolve(ipaddr);\n"+
|
204
|
-
" if (ipaddr == null)\n"+
|
205
|
-
" return false;\n"+
|
206
|
-
" } else if (test[1] > 255 || test[2] > 255 || \n"+
|
207
|
-
" test[3] > 255 || test[4] > 255) {\n"+
|
208
|
-
" return false; // not an IP address\n"+
|
209
|
-
" }\n"+
|
210
|
-
" var host = convert_addr(ipaddr);\n"+
|
211
|
-
" var pat = convert_addr(pattern);\n"+
|
212
|
-
" var mask = convert_addr(maskstr);\n"+
|
213
|
-
" return ((host & mask) == (pat & mask));\n"+
|
214
|
-
" \n"+
|
215
|
-
"}\n"+
|
216
|
-
|
217
|
-
"function isPlainHostName(host) {\n" +
|
218
|
-
" return (host.search('\\\\.') == -1);\n" +
|
219
|
-
"}\n" +
|
220
|
-
|
221
|
-
"function isResolvable(host) {\n" +
|
222
|
-
" var ip = dnsResolve(host);\n" +
|
223
|
-
" return (ip != null);\n" +
|
224
|
-
"}\n" +
|
225
|
-
|
226
|
-
"function localHostOrDomainIs(host, hostdom) {\n" +
|
227
|
-
" return (host == hostdom) ||\n" +
|
228
|
-
" (hostdom.lastIndexOf(host + '.', 0) == 0);\n" +
|
229
|
-
"}\n" +
|
230
|
-
|
231
|
-
"function shExpMatch(url, pattern) {\n" +
|
232
|
-
" pattern = pattern.replace(/\\./g, '\\\\.');\n" +
|
233
|
-
" pattern = pattern.replace(/\\*/g, '.*');\n" +
|
234
|
-
" pattern = pattern.replace(/\\?/g, '.');\n" +
|
235
|
-
" var newRe = new RegExp('^'+pattern+'$');\n" +
|
236
|
-
" return newRe.test(url);\n" +
|
237
|
-
"}\n" +
|
238
|
-
|
239
|
-
"var wdays = new Array('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT');\n" +
|
240
|
-
|
241
|
-
"var monthes = new Array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');\n"+
|
242
|
-
|
243
|
-
"function weekdayRange() {\n" +
|
244
|
-
" function getDay(weekday) {\n" +
|
245
|
-
" for (var i = 0; i < 6; i++) {\n" +
|
246
|
-
" if (weekday == wdays[i]) \n" +
|
247
|
-
" return i;\n" +
|
248
|
-
" }\n" +
|
249
|
-
" return -1;\n" +
|
250
|
-
" }\n" +
|
251
|
-
" var date = new Date();\n" +
|
252
|
-
" var argc = arguments.length;\n" +
|
253
|
-
" var wday;\n" +
|
254
|
-
" if (argc < 1)\n" +
|
255
|
-
" return false;\n" +
|
256
|
-
" if (arguments[argc - 1] == 'GMT') {\n" +
|
257
|
-
" argc--;\n" +
|
258
|
-
" wday = date.getUTCDay();\n" +
|
259
|
-
" } else {\n" +
|
260
|
-
" wday = date.getDay();\n" +
|
261
|
-
" }\n" +
|
262
|
-
" var wd1 = getDay(arguments[0]);\n" +
|
263
|
-
" var wd2 = (argc == 2) ? getDay(arguments[1]) : wd1;\n" +
|
264
|
-
" return (wd1 == -1 || wd2 == -1) ? false\n" +
|
265
|
-
" : (wd1 <= wday && wday <= wd2);\n" +
|
266
|
-
"}\n" +
|
267
|
-
|
268
|
-
"function dateRange() {\n" +
|
269
|
-
" function getMonth(name) {\n" +
|
270
|
-
" for (var i = 0; i < 6; i++) {\n" +
|
271
|
-
" if (name == monthes[i])\n" +
|
272
|
-
" return i;\n" +
|
273
|
-
" }\n" +
|
274
|
-
" return -1;\n" +
|
275
|
-
" }\n" +
|
276
|
-
" var date = new Date();\n" +
|
277
|
-
" var argc = arguments.length;\n" +
|
278
|
-
" if (argc < 1) {\n" +
|
279
|
-
" return false;\n" +
|
280
|
-
" }\n" +
|
281
|
-
" var isGMT = (arguments[argc - 1] == 'GMT');\n" +
|
282
|
-
"\n" +
|
283
|
-
" if (isGMT) {\n" +
|
284
|
-
" argc--;\n" +
|
285
|
-
" }\n" +
|
286
|
-
" // function will work even without explict handling of this case\n" +
|
287
|
-
" if (argc == 1) {\n" +
|
288
|
-
" var tmp = parseInt(arguments[0]);\n" +
|
289
|
-
" if (isNaN(tmp)) {\n" +
|
290
|
-
" return ((isGMT ? date.getUTCMonth() : date.getMonth()) ==\n" +
|
291
|
-
"getMonth(arguments[0]));\n" +
|
292
|
-
" } else if (tmp < 32) {\n" +
|
293
|
-
" return ((isGMT ? date.getUTCDate() : date.getDate()) == tmp);\n" +
|
294
|
-
" } else { \n" +
|
295
|
-
" return ((isGMT ? date.getUTCFullYear() : date.getFullYear()) ==\n" +
|
296
|
-
"tmp);\n" +
|
297
|
-
" }\n" +
|
298
|
-
" }\n" +
|
299
|
-
" var year = date.getFullYear();\n" +
|
300
|
-
" var date1, date2;\n" +
|
301
|
-
" date1 = new Date(year, 0, 1, 0, 0, 0);\n" +
|
302
|
-
" date2 = new Date(year, 11, 31, 23, 59, 59);\n" +
|
303
|
-
" var adjustMonth = false;\n" +
|
304
|
-
" for (var i = 0; i < (argc >> 1); i++) {\n" +
|
305
|
-
" var tmp = parseInt(arguments[i]);\n" +
|
306
|
-
" if (isNaN(tmp)) {\n" +
|
307
|
-
" var mon = getMonth(arguments[i]);\n" +
|
308
|
-
" date1.setMonth(mon);\n" +
|
309
|
-
" } else if (tmp < 32) {\n" +
|
310
|
-
" adjustMonth = (argc <= 2);\n" +
|
311
|
-
" date1.setDate(tmp);\n" +
|
312
|
-
" } else {\n" +
|
313
|
-
" date1.setFullYear(tmp);\n" +
|
314
|
-
" }\n" +
|
315
|
-
" }\n" +
|
316
|
-
" for (var i = (argc >> 1); i < argc; i++) {\n" +
|
317
|
-
" var tmp = parseInt(arguments[i]);\n" +
|
318
|
-
" if (isNaN(tmp)) {\n" +
|
319
|
-
" var mon = getMonth(arguments[i]);\n" +
|
320
|
-
" date2.setMonth(mon);\n" +
|
321
|
-
" } else if (tmp < 32) {\n" +
|
322
|
-
" date2.setDate(tmp);\n" +
|
323
|
-
" } else {\n" +
|
324
|
-
" date2.setFullYear(tmp);\n" +
|
325
|
-
" }\n" +
|
326
|
-
" }\n" +
|
327
|
-
" if (adjustMonth) {\n" +
|
328
|
-
" date1.setMonth(date.getMonth());\n" +
|
329
|
-
" date2.setMonth(date.getMonth());\n" +
|
330
|
-
" }\n" +
|
331
|
-
" if (isGMT) {\n" +
|
332
|
-
" var tmp = date;\n" +
|
333
|
-
" tmp.setFullYear(date.getUTCFullYear());\n" +
|
334
|
-
" tmp.setMonth(date.getUTCMonth());\n" +
|
335
|
-
" tmp.setDate(date.getUTCDate());\n" +
|
336
|
-
" tmp.setHours(date.getUTCHours());\n" +
|
337
|
-
" tmp.setMinutes(date.getUTCMinutes());\n" +
|
338
|
-
" tmp.setSeconds(date.getUTCSeconds());\n" +
|
339
|
-
" date = tmp;\n" +
|
340
|
-
" }\n" +
|
341
|
-
" return ((date1 <= date) && (date <= date2));\n" +
|
342
|
-
"}\n" +
|
343
|
-
|
344
|
-
"function timeRange() {\n" +
|
345
|
-
" var argc = arguments.length;\n" +
|
346
|
-
" var date = new Date();\n" +
|
347
|
-
" var isGMT= false;\n"+
|
348
|
-
"\n" +
|
349
|
-
" if (argc < 1) {\n" +
|
350
|
-
" return false;\n" +
|
351
|
-
" }\n" +
|
352
|
-
" if (arguments[argc - 1] == 'GMT') {\n" +
|
353
|
-
" isGMT = true;\n" +
|
354
|
-
" argc--;\n" +
|
355
|
-
" }\n" +
|
356
|
-
"\n" +
|
357
|
-
" var hour = isGMT ? date.getUTCHours() : date.getHours();\n" +
|
358
|
-
" var date1, date2;\n" +
|
359
|
-
" date1 = new Date();\n" +
|
360
|
-
" date2 = new Date();\n" +
|
361
|
-
"\n" +
|
362
|
-
" if (argc == 1) {\n" +
|
363
|
-
" return (hour == arguments[0]);\n" +
|
364
|
-
" } else if (argc == 2) {\n" +
|
365
|
-
" return ((arguments[0] <= hour) && (hour <= arguments[1]));\n" +
|
366
|
-
" } else {\n" +
|
367
|
-
" switch (argc) {\n" +
|
368
|
-
" case 6:\n" +
|
369
|
-
" date1.setSeconds(arguments[2]);\n" +
|
370
|
-
" date2.setSeconds(arguments[5]);\n" +
|
371
|
-
" case 4:\n" +
|
372
|
-
" var middle = argc >> 1;\n" +
|
373
|
-
" date1.setHours(arguments[0]);\n" +
|
374
|
-
" date1.setMinutes(arguments[1]);\n" +
|
375
|
-
" date2.setHours(arguments[middle]);\n" +
|
376
|
-
" date2.setMinutes(arguments[middle + 1]);\n" +
|
377
|
-
" if (middle == 2) {\n" +
|
378
|
-
" date2.setSeconds(59);\n" +
|
379
|
-
" }\n" +
|
380
|
-
" break;\n" +
|
381
|
-
" default:\n" +
|
382
|
-
" throw 'timeRange: bad number of arguments'\n" +
|
383
|
-
" }\n" +
|
384
|
-
" }\n" +
|
385
|
-
"\n" +
|
386
|
-
" if (isGMT) {\n" +
|
387
|
-
" date.setFullYear(date.getUTCFullYear());\n" +
|
388
|
-
" date.setMonth(date.getUTCMonth());\n" +
|
389
|
-
" date.setDate(date.getUTCDate());\n" +
|
390
|
-
" date.setHours(date.getUTCHours());\n" +
|
391
|
-
" date.setMinutes(date.getUTCMinutes());\n" +
|
392
|
-
" date.setSeconds(date.getUTCSeconds());\n" +
|
393
|
-
" }\n" +
|
394
|
-
" return ((date1 <= date) && (date <= date2));\n" +
|
395
|
-
"}\n"
|
396
|
-
|
@@ -1,175 +0,0 @@
|
|
1
|
-
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
-
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
-
*
|
4
|
-
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
-
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
-
* the License. You may obtain a copy of the License at
|
7
|
-
* http://www.mozilla.org/MPL/
|
8
|
-
*
|
9
|
-
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
-
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
-
* for the specific language governing rights and limitations under the
|
12
|
-
* License.
|
13
|
-
*
|
14
|
-
* The Original Code is Mozilla Pref Resetter.
|
15
|
-
*
|
16
|
-
* The Initial Developer of the Original Code is
|
17
|
-
* Netscape Communications Corp.
|
18
|
-
* Portions created by the Initial Developer are Copyright (C) 2002
|
19
|
-
* the Initial Developer. All Rights Reserved.
|
20
|
-
*
|
21
|
-
* Contributor(s):
|
22
|
-
* Bill Law <law@netscape.com>
|
23
|
-
*
|
24
|
-
* Alternatively, the contents of this file may be used under the terms of
|
25
|
-
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
-
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
-
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
-
* of those above. If you wish to allow use of your version of this file only
|
29
|
-
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
-
* use your version of this file under the terms of the MPL, indicate your
|
31
|
-
* decision by deleting the provisions above and replace them with the notice
|
32
|
-
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
-
* the provisions above, a recipient may use your version of this file under
|
34
|
-
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
-
*
|
36
|
-
* ***** END LICENSE BLOCK ***** */
|
37
|
-
|
38
|
-
/* This file implements the nsICmdLineHandler interface. See nsICmdLineHandler.idl
|
39
|
-
* at http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/public/nsICmdLineHandler.idl.
|
40
|
-
*
|
41
|
-
* This component handles the startup command line argument of the form:
|
42
|
-
* -resetPref pref1,pref2,pref3
|
43
|
-
* by resetting the user prefs pref1, pref2, and pref3 (an arbitrary list of pref names
|
44
|
-
* separated by commas).
|
45
|
-
*
|
46
|
-
* The module is registered under the contractid
|
47
|
-
* "@mozilla.org/commandlinehandler/general-startup;1?type=resetPref"
|
48
|
-
*
|
49
|
-
* The implementation consists of a JavaScript "class" named nsResetPref,
|
50
|
-
* comprised of:
|
51
|
-
* - a JS constructor function
|
52
|
-
* - a prototype providing all the interface methods and implementation stuff
|
53
|
-
*
|
54
|
-
* In addition, this file implements an nsIModule object that registers the
|
55
|
-
* nsResetPref component.
|
56
|
-
*/
|
57
|
-
|
58
|
-
/* ctor
|
59
|
-
*/
|
60
|
-
function nsResetPref() {
|
61
|
-
}
|
62
|
-
|
63
|
-
nsResetPref.prototype = {
|
64
|
-
// Turn this on to get debugging messages.
|
65
|
-
debug: false,
|
66
|
-
|
67
|
-
// nsICmdLineHandler interface
|
68
|
-
get commandLineArgument() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
69
|
-
get prefNameForStartup() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
70
|
-
get chromeUrlForTask() {
|
71
|
-
try {
|
72
|
-
// We trust that this has been called during command-line handling during
|
73
|
-
// startup from nsAppRunner.cpp.
|
74
|
-
|
75
|
-
// We get the command line service and from that the -resetPref argument.
|
76
|
-
var cmdLine = Components.classes[ "@mozilla.org/app-startup/commandLineService;1" ]
|
77
|
-
.getService( Components.interfaces.nsICmdLineService );
|
78
|
-
var prefList = cmdLine.getCmdLineValue( "-resetPref" ).split( "," );
|
79
|
-
|
80
|
-
// Get pref service.
|
81
|
-
var prefs = Components.classes[ "@mozilla.org/preferences-service;1" ]
|
82
|
-
.getService( Components.interfaces.nsIPrefService );
|
83
|
-
|
84
|
-
// For each pref specified on the cmd line, reset the user pref value.
|
85
|
-
for ( i in prefList ) {
|
86
|
-
var pref = prefs.getBranch( prefList[ i ] );
|
87
|
-
try {
|
88
|
-
pref.clearUserPref( "" );
|
89
|
-
} catch( e ) {
|
90
|
-
}
|
91
|
-
}
|
92
|
-
} catch( e ) {
|
93
|
-
this.dump( "exception: " + e );
|
94
|
-
}
|
95
|
-
|
96
|
-
// Return an error (so nsAppRunner doesn't think we've opened a window).
|
97
|
-
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
98
|
-
},
|
99
|
-
get helpText() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
100
|
-
get handlesArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
101
|
-
get defaultArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
102
|
-
get openWindowWithArgs() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
103
|
-
|
104
|
-
// nsISupports interface
|
105
|
-
|
106
|
-
// This "class" supports nsICmdLineHandler and nsISupports.
|
107
|
-
QueryInterface: function (iid) {
|
108
|
-
if (iid.equals(Components.interfaces.nsICmdLineHandler) ||
|
109
|
-
iid.equals(Components.interfaces.nsISupports))
|
110
|
-
return this;
|
111
|
-
|
112
|
-
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
|
113
|
-
return null;
|
114
|
-
},
|
115
|
-
|
116
|
-
// Dump text (if debug is on).
|
117
|
-
dump: function( text ) {
|
118
|
-
if ( this.debug ) {
|
119
|
-
dump( "nsResetPref: " + text + "\n" );
|
120
|
-
}
|
121
|
-
},
|
122
|
-
|
123
|
-
// This Component's module implementation. All the code below is used to get this
|
124
|
-
// component registered and accessible via XPCOM.
|
125
|
-
module: {
|
126
|
-
// registerSelf: Register this component.
|
127
|
-
registerSelf: function (compMgr, fileSpec, location, type) {
|
128
|
-
var compReg = compMgr.QueryInterface( Components.interfaces.nsIComponentRegistrar );
|
129
|
-
compReg.registerFactoryLocation( this.cid,
|
130
|
-
"Pref Reset Component",
|
131
|
-
this.contractId,
|
132
|
-
fileSpec,
|
133
|
-
location,
|
134
|
-
type );
|
135
|
-
},
|
136
|
-
|
137
|
-
// getClassObject: Return this component's factory object.
|
138
|
-
getClassObject: function (compMgr, cid, iid) {
|
139
|
-
if (!cid.equals(this.cid))
|
140
|
-
throw Components.results.NS_ERROR_NO_INTERFACE;
|
141
|
-
|
142
|
-
if (!iid.equals(Components.interfaces.nsIFactory))
|
143
|
-
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
144
|
-
|
145
|
-
return this.factory;
|
146
|
-
},
|
147
|
-
|
148
|
-
/* CID for this class */
|
149
|
-
cid: Components.ID("{15ABFAF7-AD4F-4450-899B-0373EE9FAD95}"),
|
150
|
-
|
151
|
-
/* Contract ID for this class */
|
152
|
-
contractId: "@mozilla.org/commandlinehandler/general-startup;1?type=resetPref",
|
153
|
-
|
154
|
-
/* factory object */
|
155
|
-
factory: {
|
156
|
-
// createInstance: Return a new nsResetPref object.
|
157
|
-
createInstance: function (outer, iid) {
|
158
|
-
if (outer != null)
|
159
|
-
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
160
|
-
|
161
|
-
return (new nsResetPref()).QueryInterface(iid);
|
162
|
-
}
|
163
|
-
},
|
164
|
-
|
165
|
-
// canUnload: n/a (returns true)
|
166
|
-
canUnload: function(compMgr) {
|
167
|
-
return true;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
// NSGetModule: Return the nsIModule object.
|
173
|
-
function NSGetModule(compMgr, fileSpec) {
|
174
|
-
return nsResetPref.prototype.module;
|
175
|
-
}
|