From: <dos...@us...> - 2012-07-26 21:25:45
|
Revision: 4506 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4506&view=rev Author: doskabouter Date: 2012-07-26 21:25:33 +0000 (Thu, 26 Jul 2012) Log Message: ----------- reverted gecko-13 base Modified Paths: -------------- trunk/plugins/BrowseTheWeb/Release/Files/xulrunner.zip trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/BrowseTheWeb.dll trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GetThumb.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AutoJSContext.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.Designer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.Designer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDomEvents.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoHistoryEntry.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoPreferences.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoResponse.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoSelection.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWebBrowser.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PasswordDialog.Designer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PasswordDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PromptDialog.Designer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PromptDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PromptService.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Properties/AssemblyInfo.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PropertiesDialog.Designer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PropertiesDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Readme.txt trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.csproj trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Skybound.Gecko.sln trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Xpcom.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsInterfaces.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsString.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsURI.cs Added Paths: ----------- trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/Skybound.Gecko.dll trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoDom.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoStyle.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIContentViewer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIDOMStorage.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIDocShell.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIDocShellLoadInfo.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIDocumentCharsetInfo.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsIMarkupDocumentViewer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsISHEntry.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsISecureBrowserUI.cs Removed Paths: ------------- trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/geckofx-13.dll trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AppShellService.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/BaseNsFactory.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/BaseTypes/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ByteArrayInputStream.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Cache/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Certificates/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.resources trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ClassDiagrams/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Collections/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.resources trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConsoleMessageEventArgs.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Contracts.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Cryptography/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/CustomMarshalers/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/DOM/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoElementExtensions.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoException.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoHelperAppLauncherDialog.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoMIMEInputStream.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoMarkupDocumentViewer.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoMessageEvents.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoMouseButton.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWebBrowser.Events.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWebBrowser.GTK.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWebBrowser.WinForms.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWindow.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GeckoWrapperCache.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Generated/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GtkOnceOnly.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GtkReparentingWrapperNoThread.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/GtkWrapperNoThread.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/IO/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/IOService.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ImageCreator.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Images/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Interop/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/JavascriptErrorEventArgs.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Listeners/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Microsoft.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/NavigateFinishedNotifier.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Net/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ObserverNotifications.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Observers/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/OffScreenGeckoWebBrowser.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PasswordDialog.resources trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Pipe.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Plugins/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PrintSettings.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PrivateBrowsingService.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PromptDialog.resources trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Properties.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/PropertiesDialog.resources trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/RandomGenerator.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ScreenManager.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Search/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Services/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Sound.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/TreeView.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Utils/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Variant.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/WiFiMonitor.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/WindowMediator.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Windows/ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/X11Structs.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/XULRunnerLocator.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/XulRuntime.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/geckofx-13.dll.config trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsCString.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsCancelable.cs trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/nsSupportsPrimitives.cs Modified: trunk/plugins/BrowseTheWeb/Release/Files/xulrunner.zip =================================================================== (Binary files differ) Modified: trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/BrowseTheWeb.dll =================================================================== (Binary files differ) Copied: trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/Skybound.Gecko.dll (from rev 4503, trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/Skybound.Gecko.dll) =================================================================== (Binary files differ) Deleted: trunk/plugins/BrowseTheWeb/Release/Plugins/Windows/geckofx-13.dll =================================================================== (Binary files differ) Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/BrowseTheWeb.csproj 2012-07-26 21:25:33 UTC (rev 4506) @@ -34,7 +34,7 @@ <BootstrapperEnabled>true</BootstrapperEnabled> <TargetFrameworkProfile /> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Windows|AnyCPU' "> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> @@ -45,7 +45,7 @@ <UseVSHostingProcess>false</UseVSHostingProcess> <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Windows|AnyCPU' "> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>..\..\Release\Plugins\Windows\</OutputPath> @@ -218,7 +218,7 @@ </ItemGroup> <ItemGroup> <ProjectReference Include="..\Skybound.Gecko\Skybound.Gecko.csproj"> - <Project>{6AB4EEE6-1889-43AB-83F7-A4F083230BE7}</Project> + <Project>{877D1A24-2D5E-4C46-A933-FCF11EA0403B}</Project> <Name>Skybound.Gecko</Name> </ProjectReference> </ItemGroup> Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -34,7 +34,7 @@ using System.Windows.Forms; using System.Runtime.InteropServices; -using Gecko; +using Skybound.Gecko; namespace BrowseTheWeb { @@ -287,13 +287,13 @@ webBrowser.StatusTextChanged += new EventHandler(webBrowser_StatusTextChanged); MyLog.debug("Create dom eventhandler"); - webBrowser.DomKeyDown += new EventHandler<GeckoDomKeyEventArgs>(webBrowser_DomKeyDown); - webBrowser.DomClick += new EventHandler<GeckoDomEventArgs>(webBrowser_DomClick); + webBrowser.DomKeyDown += new GeckoDomKeyEventHandler(webBrowser_DomKeyDown); + webBrowser.DomClick += new GeckoDomEventHandler(webBrowser_DomClick); MyLog.debug("set zoom size to " + settings.FontZoom + "/" + zoom); webBrowser.Window.TextZoom = settings.FontZoom; - webBrowserZoom = zoom; + webBrowser.Zoom = zoom; if (settings.Windowed) { @@ -360,8 +360,8 @@ webBrowser.DocumentCompleted -= new EventHandler(webBrowser_DocumentCompleted); webBrowser.StatusTextChanged -= new EventHandler(webBrowser_StatusTextChanged); - webBrowser.DomKeyDown -= new EventHandler<GeckoDomKeyEventArgs>(webBrowser_DomKeyDown); - webBrowser.DomClick -= new EventHandler<GeckoDomEventArgs>(webBrowser_DomClick); + webBrowser.DomKeyDown -= new GeckoDomKeyEventHandler(webBrowser_DomKeyDown); + webBrowser.DomClick -= new GeckoDomEventHandler(webBrowser_DomClick); timer.Tick -= new EventHandler(timer_Tick); timer.Stop(); @@ -762,13 +762,13 @@ private void OnZoomIn() { if (zoom < 3) zoom += 0.1f; - webBrowserZoom = zoom; + webBrowser.Zoom = zoom; if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); } private void OnZoomOut() { if (zoom > 0.1f) zoom -= 0.1f; - webBrowserZoom = zoom; + webBrowser.Zoom = zoom; if (!settings.Remote) GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); } private void OnMoveLeft() @@ -876,26 +876,26 @@ } } - private void AddElements(List<GeckoHtmlElement> list, GeckoNode parent, string elName) + private void AddElements(List<GeckoElement> list, GeckoNode parent, string elName) { - if (parent is GeckoHtmlElement && ((GeckoHtmlElement)parent).TagName.ToLowerInvariant() == elName) - list.Add((GeckoHtmlElement)parent); + if (parent is GeckoElement && ((GeckoElement)parent).TagName.ToLowerInvariant() == elName) + list.Add((GeckoElement)parent); foreach (GeckoNode child in parent.ChildNodes) AddElements(list, child, elName); } - private List<GeckoHtmlElement> getElements(GeckoNode parent, string elName) + private List<GeckoElement> getElements(GeckoNode parent, string elName) { - List<GeckoHtmlElement> res = new List<GeckoHtmlElement>(); + List<GeckoElement> res = new List<GeckoElement>(); AddElements(res, parent, elName); return res; } - private GeckoHtmlElement insertSpan(int geckoId, string geckoAction, string geckoType, string className, GeckoNode after) + private GeckoElement insertSpan(int geckoId, string geckoAction, string geckoType, string className, GeckoNode after) { if (after == null) throw new ArgumentNullException("after"); - GeckoHtmlElement newChild = after.OwnerDocument.CreateHtmlElement("span"); + GeckoElement newChild = after.OwnerDocument.CreateElement("span"); newChild.SetAttribute("style", _spanstyle); newChild.SetAttribute("gecko_id", geckoId.ToString()); newChild.SetAttribute("gecko_action", geckoAction); @@ -910,7 +910,7 @@ return newChild; } - private void SetLinkAttributes(GeckoHtmlElement link, int linkNumber, out string id, out string name) + private void SetLinkAttributes(GeckoElement link, int linkNumber, out string id, out string name) { string gb = link.GetAttribute("gb"); id = link.GetAttribute("id"); @@ -950,17 +950,17 @@ MyLog.debug("page links cnt : " + links.Count); - foreach (GeckoHtmlElement element in links) + foreach (GeckoElement element in links) { string link = element.GetAttribute("href"); if (!link.StartsWith("javascript:")) { - GeckoHtmlElement lastSpan = element; + GeckoElement lastSpan = element; bool ready = false; while (!ready) { - GeckoHtmlElement ls = lastSpan.LastChild as GeckoHtmlElement; + GeckoElement ls = lastSpan.LastChild as GeckoElement; if (ls == null || ls.TagName != "SPAN") ready = true; else @@ -968,9 +968,9 @@ }; if (!element.InnerHtml.Contains("gecko_id")) { - GeckoHtmlElement ls = element; - while (ls.LastChild != null && ls.LastChild is GeckoHtmlElement && !String.IsNullOrEmpty(ls.LastChild.TextContent)) - ls = (GeckoHtmlElement)ls.LastChild; + GeckoElement ls = element; + while (ls.LastChild != null && ls.LastChild is GeckoElement && !String.IsNullOrEmpty(ls.LastChild.TextContent)) + ls = (GeckoElement)ls.LastChild; insertSpan(i, String.Empty, "LINK", lastSpan.ClassName, ls); } @@ -984,11 +984,11 @@ GeckoElementCollection objects = webBrowser.Document.GetElementsByTagName("object"); MyLog.debug("page objects cnt : " + objects.Count); - foreach (GeckoHtmlElement element in objects) + foreach (GeckoElement element in objects) if (element.GetAttribute("type") == "application/x-shockwave-flash") { string id, name; - GeckoHtmlElement element2 = element.Parent; + GeckoElement element2 = element.Parent; SetLinkAttributes(element2, i, out id, out name); if (!element2.InnerHtml.Contains("gecko_id=\"" + i + "\"")) @@ -1005,11 +1005,11 @@ MyLog.debug("page forms cnt : " + forms.Count); - foreach (GeckoHtmlElement element in forms) + foreach (GeckoElement element in forms) { - List<GeckoHtmlElement> inps = getElements(element, "input"); + List<GeckoElement> inps = getElements(element, "input"); string action = element.GetAttribute("action"); - foreach (GeckoHtmlElement link in inps) + foreach (GeckoElement link in inps) { string linkType = link.GetAttribute("type"); if (!String.IsNullOrEmpty(linkType)) @@ -1062,7 +1062,7 @@ #region reset zoom if (settings.ZoomPage) { - webBrowserZoom = settings.DefaultZoom; + webBrowser.Zoom = settings.DefaultZoom; zoom = settings.DefaultZoom; GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); } @@ -1071,7 +1071,7 @@ if (lastDomain != webBrowser.Document.Domain) { { - webBrowserZoom = settings.DefaultZoom; + webBrowser.Zoom = settings.DefaultZoom; zoom = settings.DefaultZoom; GUIPropertyManager.SetProperty("#btWeb.status", "Zoom set to " + (int)(zoom * 100)); } @@ -1083,7 +1083,7 @@ { using (System.IO.StreamWriter tw = new System.IO.StreamWriter(@"e:\last.html")) { - tw.WriteLine(((GeckoHtmlElement)webBrowser.Document.DocumentElement).InnerHtml); + tw.WriteLine(webBrowser.Document.DocumentElement.InnerHtml); } } } @@ -1187,7 +1187,7 @@ private bool SetInputElementValue(GeckoNode parent, int geckoId, string text) { - GeckoHtmlElement el = parent as GeckoHtmlElement; + GeckoElement el = parent as GeckoElement; if (el != null && el.TagName.ToLowerInvariant() == "input" && el.GetAttribute("gb") == "gecko_link" + geckoId) { el.SetAttribute("value", text); @@ -1234,13 +1234,5 @@ { MediaPortal.Util.Utils.PlaySound(strFilePath, false, true); } - - private float webBrowserZoom - { - set - { - webBrowser.GetMarkupDocumentViewer().SetFullZoomAttribute(value); - } - } } } Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GetThumb.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GetThumb.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GetThumb.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -26,7 +26,7 @@ using System.Drawing; using System.Windows.Forms; -using Gecko; +using Skybound.Gecko; namespace BrowseTheWeb { Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -27,7 +27,7 @@ using System.Windows.Forms; using System.IO; -using Gecko; +using Skybound.Gecko; using Ionic.Zip; using MediaPortal.Configuration; @@ -82,8 +82,8 @@ FileInfo info = new FileInfo(plugins + "\\Windows\\HtmlAgilityPack.dll"); Log.Debug("BrowseTheWeb | HtmlAgilityPack: " + info.CreationTime); - info = new FileInfo(plugins + "\\Windows\\geckofx-13.dll"); - Log.Debug("BrowseTheWeb | geckofx-13.dll: " + info.CreationTime); + info = new FileInfo(plugins + "\\Windows\\Skybound.Gecko.dll"); + Log.Debug("BrowseTheWeb | Skybound.Gecko.dll: " + info.CreationTime); try { Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb.sln 2012-07-26 21:25:33 UTC (rev 4506) @@ -3,62 +3,32 @@ # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowseTheWeb", "BrowseTheWeb\BrowseTheWeb.csproj", "{70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skybound.Gecko", "Skybound.Gecko\Skybound.Gecko.csproj", "{6AB4EEE6-1889-43AB-83F7-A4F083230BE7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skybound.Gecko", "Skybound.Gecko\Skybound.Gecko.csproj", "{877D1A24-2D5E-4C46-A933-FCF11EA0403B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug_Linux|Any CPU = Debug_Linux|Any CPU - Debug_Linux|Mixed Platforms = Debug_Linux|Mixed Platforms - Debug_Linux|x86 = Debug_Linux|x86 - Debug_Windows|Any CPU = Debug_Windows|Any CPU - Debug_Windows|Mixed Platforms = Debug_Windows|Mixed Platforms - Debug_Windows|x86 = Debug_Windows|x86 - Release_Linux|Any CPU = Release_Linux|Any CPU - Release_Linux|Mixed Platforms = Release_Linux|Mixed Platforms - Release_Linux|x86 = Release_Linux|x86 - Release_Windows|Any CPU = Release_Windows|Any CPU - Release_Windows|Mixed Platforms = Release_Windows|Mixed Platforms - Release_Windows|x86 = Release_Windows|x86 + Debug 1.8|Any CPU = Debug 1.8|Any CPU + Debug 1.9|Any CPU = Debug 1.9|Any CPU + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Linux|Any CPU.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Linux|Any CPU.Build.0 = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Linux|Mixed Platforms.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Linux|x86.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Windows|Any CPU.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Windows|Any CPU.Build.0 = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Windows|Mixed Platforms.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Windows|Mixed Platforms.Build.0 = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug_Windows|x86.ActiveCfg = Debug_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Linux|Any CPU.ActiveCfg = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Linux|Any CPU.Build.0 = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Linux|Mixed Platforms.ActiveCfg = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Linux|x86.ActiveCfg = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Windows|Any CPU.ActiveCfg = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Windows|Any CPU.Build.0 = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Windows|Mixed Platforms.ActiveCfg = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Windows|Mixed Platforms.Build.0 = Release_Windows|Any CPU - {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release_Windows|x86.ActiveCfg = Release_Windows|Any CPU - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Linux|Any CPU.ActiveCfg = Debug_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Linux|Mixed Platforms.ActiveCfg = Debug_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Linux|Mixed Platforms.Build.0 = Debug_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Linux|x86.ActiveCfg = Debug_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Linux|x86.Build.0 = Debug_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Windows|Any CPU.ActiveCfg = Debug_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Windows|Mixed Platforms.ActiveCfg = Debug_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Windows|Mixed Platforms.Build.0 = Debug_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Windows|x86.ActiveCfg = Debug_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Debug_Windows|x86.Build.0 = Debug_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Linux|Any CPU.ActiveCfg = Release_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Linux|Mixed Platforms.ActiveCfg = Release_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Linux|Mixed Platforms.Build.0 = Release_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Linux|x86.ActiveCfg = Release_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Linux|x86.Build.0 = Release_Linux|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Windows|Any CPU.ActiveCfg = Release_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Windows|Mixed Platforms.ActiveCfg = Release_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Windows|Mixed Platforms.Build.0 = Release_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Windows|x86.ActiveCfg = Release_Windows|x86 - {6AB4EEE6-1889-43AB-83F7-A4F083230BE7}.Release_Windows|x86.Build.0 = Release_Windows|x86 + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug 1.8|Any CPU.ActiveCfg = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug 1.8|Any CPU.Build.0 = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug 1.9|Any CPU.ActiveCfg = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug 1.9|Any CPU.Build.0 = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70ECF0E8-19B6-43A9-B3B5-B1BB13F6E241}.Release|Any CPU.Build.0 = Release|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug 1.8|Any CPU.ActiveCfg = Debug 1.8|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug 1.8|Any CPU.Build.0 = Debug 1.8|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug 1.9|Any CPU.ActiveCfg = Debug 1.9|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug 1.9|Any CPU.Build.0 = Debug 1.9|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {877D1A24-2D5E-4C46-A933-FCF11EA0403B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AppShellService.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AppShellService.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AppShellService.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Gecko.Interop; - -namespace Gecko -{ - public static class AppShellService - { - private static ServiceWrapper<nsIAppShellService> _appShellService; - - static AppShellService() - { - _appShellService=new ServiceWrapper<nsIAppShellService>( Contracts.AppShellService ); - - - } - - public static void CreateHiddenWindow() - { - _appShellService.Instance.CreateHiddenWindow(); - } - - public static nsIXULWindow CreateTopLevelWindow( nsIXULWindow aParent, nsIURI aUrl, uint aChromeMask, int aInitialWidth, int aInitialHeight) - { - return _appShellService.Instance.CreateTopLevelWindow( aParent, aUrl, aChromeMask, aInitialWidth, aInitialHeight ); - } - } -} Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AutoJSContext.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AutoJSContext.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/AutoJSContext.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -35,84 +35,319 @@ using System; using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; -using System.Text; -namespace Gecko +namespace Skybound.Gecko { /// <summary> /// Creates a scoped, fake "system principal" security context. This class is used primarly to work around bugs in gecko /// which prevent methods on nsIDOMCSSStyleSheet from working outside of javascript. /// </summary> - public class AutoJSContext : IDisposable - { - IntPtr _cx; + class AutoJSContext : IDisposable + { + #region Unmanaged Interfaces - public IntPtr ContextPointer { get { return _cx; } } - - private readonly nsIThreadJSContextStack _jsContextStack; - private readonly nsIJSContextStack _contextStack; - private readonly nsIScriptSecurityManager _securityManager; - private readonly nsIPrincipal _systemPrincipal; - - /// <summary> - /// Create a AutoJSContext using the SafeJSContext. - /// If context is IntPtr.Zero use the SafeJSContext - /// </summary> - /// <param name="context"></param> - public AutoJSContext(IntPtr context) + [Guid("c67d8270-3189-11d3-9885-006008962422"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface nsIJSContextStack { - if (context == IntPtr.Zero) - { - _jsContextStack = Xpcom.GetService<nsIThreadJSContextStack>("@mozilla.org/js/xpc/ContextStack;1"); - context = _jsContextStack.GetSafeJSContextAttribute(); - } + int GetCount(); + IntPtr Peek(); + IntPtr Pop(); + void Push(IntPtr cx); + } + + #if GECKO_1_9_1 + [Guid("f8e350b9-9f31-451a-8c8f-d10fea26b780"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + #elif GECKO_1_9 + [Guid("3fffd8e8-3fea-442e-a0ed-2ba81ae197d5"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + #elif GECKO_1_8 + [Guid("f4d74511-2b2d-4a14-a3e4-a392ac5ac3ff"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + #endif + interface nsIScriptSecurityManager + { + // nsIXPCSecurityManager: + void CanCreateWrapper(out IntPtr aJSContext, ref Guid aIID, nsISupports aObj, IntPtr aClassInfo, IntPtr aPolicy); // aClassInfo=nsIClassInfo + void CanCreateInstance(out IntPtr aJSContext, ref Guid aCID); + void CanGetService(out IntPtr aJSContext, ref Guid aCID); + void CanAccess(uint aAction, IntPtr aCallContext, out IntPtr aJSContext, out IntPtr aJSObject, nsISupports aObj, IntPtr aClassInfo, IntPtr aName, IntPtr aPolicy); // aCallContext=nsIXPCNativeCallContext - _cx = context; - - // begin a new request - SpiderMonkey.JS_BeginRequest(_cx); - - // push the context onto the context stack - _contextStack = Xpcom.GetService<nsIJSContextStack>("@mozilla.org/js/xpc/ContextStack;1"); - _contextStack.Push(_cx); - - // obtain the system principal (no security checks) (one could get a different principal by calling securityManager.GetObjectPrincipal()) - _securityManager = Xpcom.GetService<nsIScriptSecurityManager>("@mozilla.org/scriptsecuritymanager;1"); - _systemPrincipal = _securityManager.GetSystemPrincipal(); - _securityManager.PushContextPrincipal(_cx, IntPtr.Zero, _systemPrincipal); + #if GECKO_1_8 + // nsIScriptSecurityManager: + void CheckPropertyAccess(out IntPtr aJSContext, out IntPtr aJSObject, [MarshalAs(UnmanagedType.LPStr)] out string aClassName, IntPtr aProperty, uint aAction); + void CheckConnect(out IntPtr aJSContext, nsIURI aTargetURI, [MarshalAs(UnmanagedType.LPStr)] out string aClassName, [MarshalAs(UnmanagedType.LPStr)] string aProperty); + void CheckLoadURIFromScript(out IntPtr cx, nsIURI uri); + void CheckLoadURIWithPrincipal(nsIPrincipal aPrincipal, nsIURI uri, uint flags); + void CheckLoadURI(nsIURI from, nsIURI uri, uint flags); + void CheckLoadURIStr(nsACString from, nsACString uri, uint flags); + void CheckFunctionAccess(out IntPtr cx, out IntPtr funObj, IntPtr targetObj); + bool CanExecuteScripts(out IntPtr cx, nsIPrincipal principal); + nsIPrincipal GetSubjectPrincipal(); + nsIPrincipal GetSystemPrincipal(); + nsIPrincipal GetCertificatePrincipal(nsACString aCertFingerprint, nsACString aSubjectName, nsACString aPrettyName, nsISupports aCert, nsIURI aURI); + nsIPrincipal GetCodebasePrincipal(nsIURI aURI); + short RequestCapability(nsIPrincipal principal, [MarshalAs(UnmanagedType.LPStr)] out string capability); + bool IsCapabilityEnabled([MarshalAs(UnmanagedType.LPStr)] out string capability); + void EnableCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void RevertCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void DisableCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void SetCanEnableCapability(nsACString certificateFingerprint, [MarshalAs(UnmanagedType.LPStr)] out string capability, short canEnable); + nsIPrincipal GetObjectPrincipal(out IntPtr aJSContext, out IntPtr aJSObject); + bool SubjectPrincipalIsSystem(); + void CheckSameOrigin(out IntPtr aJSContext, nsIURI aTargetURI); + void CheckSameOriginURI(nsIURI aSourceURI, nsIURI aTargetURI); + void CheckSameOriginPrincipal(nsIPrincipal aSourcePrincipal, nsIPrincipal aTargetPrincipal); + nsIPrincipal GetPrincipalFromContext(out IntPtr aJSContext); + bool SecurityCompareURIs(nsIURI aSubjectURI, nsIURI aObjectURI); + #elif GECKO_1_9 + // nsIScriptSecurityManager: + void CheckPropertyAccess(out IntPtr aJSContext, out IntPtr aJSObject, [MarshalAs(UnmanagedType.LPStr)] string aClassName, IntPtr aProperty, uint aAction); // aProperty=jsval + void CheckConnect(out IntPtr aJSContext, nsIURI aTargetURI, [MarshalAs(UnmanagedType.LPStr)] string aClassName, [MarshalAs(UnmanagedType.LPStr)] string aProperty); + void CheckLoadURIFromScript(out IntPtr cx, nsIURI uri); + void CheckLoadURIWithPrincipal(nsIPrincipal aPrincipal, nsIURI uri, uint flags); + void CheckLoadURI(nsIURI from, nsIURI uri, uint flags); + void CheckLoadURIStrWithPrincipal(nsIPrincipal aPrincipal, nsACString uri, uint flags); + void CheckLoadURIStr(nsACString from, nsACString uri, uint flags); + void CheckFunctionAccess(out IntPtr cx, out IntPtr funObj, IntPtr targetObj); + bool CanExecuteScripts(out IntPtr cx, nsIPrincipal principal); + nsIPrincipal GetSubjectPrincipal(); + nsIPrincipal GetSystemPrincipal(); + nsIPrincipal GetCertificatePrincipal(nsACString aCertFingerprint, nsACString aSubjectName, nsACString aPrettyName, nsISupports aCert, nsIURI aURI); + nsIPrincipal GetCodebasePrincipal(nsIURI aURI); + short RequestCapability(nsIPrincipal principal, [MarshalAs(UnmanagedType.LPStr)] string capability); + bool IsCapabilityEnabled([MarshalAs(UnmanagedType.LPStr)] string capability); + void EnableCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void RevertCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void DisableCapability([MarshalAs(UnmanagedType.LPStr)] string capability); + void SetCanEnableCapability(nsACString certificateFingerprint, [MarshalAs(UnmanagedType.LPStr)] string capability, short canEnable); + nsIPrincipal GetObjectPrincipal(out IntPtr cx, out IntPtr aJSObject); + bool SubjectPrincipalIsSystem(); + void CheckSameOrigin(out IntPtr aJSContext, nsIURI aTargetURI); + void CheckSameOriginURI(nsIURI aSourceURI, nsIURI aTargetURI, bool reportError); + nsIPrincipal GetPrincipalFromContext(out IntPtr cx); + nsIPrincipal GetChannelPrincipal(IntPtr aChannel); // nsIChannel + bool IsSystemPrincipal(nsIPrincipal aPrincipal); + nsIPrincipal GetCxSubjectPrincipal(IntPtr cx); // JSContext + #if GECKO_1_9_1 + nsIPrincipal getCxSubjectPrincipalAndFrame(IntPtr cx, out IntPtr fp); + #endif + #endif } - - /// <summary> - /// Create a AutoJSContext using the SafeJSContext. - /// </summary> - public AutoJSContext() : this(IntPtr.Zero) + + #if GECKO_1_8 + [Guid("fb9ddeb9-26f9-46b8-85d5-3978aaee05aa"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + #elif GECKO_1_9 + [Guid("b8268b9a-2403-44ed-81e3-614075c92034"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + #endif + interface nsIPrincipal { + // nsISerializable: + void Read(IntPtr aInputStream); // nsIObjectInputStream + void Write(IntPtr aOutputStream); // nsIObjectOutputStream + + // nsIPrincipal: + void GetPreferences(out string prefBranch, out string id, out string subjectName, out string grantedList, out string deniedList); + bool Equals(nsIPrincipal other); + uint GetHashValue(); + IntPtr GetJSPrincipals(IntPtr aJSContext); // returns: JSPrincipals + IntPtr GetSecurityPolicy(); + IntPtr SetSecurityPolicy(); + short CanEnableCapability(out string capability); + void SetCanEnableCapability(out string capability, short canEnable); + bool IsCapabilityEnabled(out string capability, out IntPtr annotation); + void EnableCapability(out string capability, IntPtr annotation); + void RevertCapability(out string capability, IntPtr annotation); + void DisableCapability(out string capability, IntPtr annotation); + nsIURI GetURI(); + nsIURI GetDomain(); + void SetDomain(nsIURI aDomain); + [return: MarshalAs(UnmanagedType.LPStr)] string GetOrigin(); + bool GetHasCertificate(); + void GetFingerprint(nsACString aFingerprint); + void GetPrettyName(nsACString aPrettyName); + bool Subsumes(nsIPrincipal other); + #if GECKO_1_9 + void CheckMayLoad(nsIURI uri, bool report); + #endif + void GetSubjectName(nsACString aSubjectName); + nsISupports GetCertificate(); } - - /// <summary> - /// Evaluate javascript in the current context. - /// </summary> - /// <param name="jsScript"></param> - /// <param name="jsval"></param> - /// <returns></returns> - public bool EvaluateScript(string jsScript, out string result) + + [Guid("e7d09265-4c23-4028-b1b0-c99e02aa78f8"), ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + interface nsIJSRuntimeService { - var ptr = new JsVal(); - IntPtr globalObject = SpiderMonkey.JS_GetGlobalForScopeChain(_cx); - bool ret = SpiderMonkey.JS_EvaluateScript(_cx, globalObject, jsScript, (uint)jsScript.Length, "script", 1, ref ptr); - - IntPtr jsStringPtr = SpiderMonkey.JS_ValueToString(_cx, ptr); - result = Marshal.PtrToStringAnsi(SpiderMonkey.JS_EncodeString(_cx, jsStringPtr)); - return ret; - } - + IntPtr GetRuntime(); + IntPtr GetBackstagePass(); // nsIXPCScriptable + } + + #if GECKO_1_8 + [StructLayout(LayoutKind.Sequential)] + struct JSStackFrame + { + IntPtr callobj; /* lazily created Call object */ + IntPtr argsobj; /* lazily created arguments object */ + IntPtr varobj; /* variables object, where vars go */ + public IntPtr script; /* script being interpreted */ + IntPtr fun; /* function being called or null */ + IntPtr thisp; /* "this" pointer if in method */ + IntPtr argc; /* actual argument count */ + IntPtr argv; /* base of argument stack slots */ + int rval; /* function return value */ + uint nvars; /* local variable count */ + IntPtr vars; /* base of variable stack slots */ + public IntPtr down; /* previous frame */ + IntPtr annotation; /* used by Java security */ + IntPtr scopeChain; /* scope chain */ + IntPtr pc; /* program counter */ + IntPtr sp; /* stack pointer */ + IntPtr spbase; /* operand stack base */ + uint sharpDepth; /* array/object initializer depth */ + IntPtr sharpArray; /* scope for #n= initializer vars */ + uint flags; /* frame flags -- see below */ + IntPtr dormantNext; /* next dormant frame chain */ + IntPtr xmlNamespace; /* null or default xml namespace in E4X */ + IntPtr blockChain; /* active compile-time block scopes */ + } + #elif GECKO_1_9_1 + [StructLayout(LayoutKind.Sequential)] + struct JSStackFrame + { + IntPtr regs; + IntPtr imacpc; /* null or interpreter macro call pc */ + IntPtr slots; /* variables, locals and operand stack */ + IntPtr callobj; /* lazily created Call object */ + IntPtr argsobj; /* lazily created arguments object */ + IntPtr varobj; /* variables object, where vars go */ + IntPtr callee; /* function or script object */ + public IntPtr script; /* script being interpreted */ + IntPtr fun; /* function being called or null */ + IntPtr thisp; /* "this" pointer if in method */ + uint argc; /* actual argument count */ + IntPtr argv; /* base of argument stack slots */ + IntPtr rval; /* function return value */ + public IntPtr down; /* previous frame */ + IntPtr annotation; /* used by Java security */ + IntPtr scopeChain; + IntPtr blockChain; + uint sharpDepth; /* array/object initializer depth */ + IntPtr sharpArray; /* scope for #n= initializer vars */ + uint flags; /* frame flags -- see below */ + IntPtr dormantNext; /* next dormant frame chain */ + IntPtr xmlNamespace; /* null or default xml namespace in E4X */ + IntPtr displaySave; /* previous value of display entry for script->staticLevel */ + } + #elif GECKO_1_9 + [StructLayout(LayoutKind.Sequential)] + struct JSStackFrame + { + IntPtr regs; + IntPtr spbase; /* operand stack base */ + IntPtr callobj; /* lazily created Call object */ + IntPtr argsobj; /* lazily created arguments object */ + IntPtr varobj; /* variables object, where vars go */ + IntPtr callee; /* function or script object */ + public IntPtr script; /* script being interpreted */ + IntPtr fun; /* function being called or null */ + IntPtr thisp; /* "this" pointer if in method */ + IntPtr argc; /* actual argument count */ + IntPtr argv; /* base of argument stack slots */ + int rval; /* function return value */ + uint nvars; /* local variable count */ + IntPtr vars; /* base of variable stack slots */ + public IntPtr down; /* previous frame */ + IntPtr annotation; /* used by Java security */ + IntPtr scopeChain; /* scope chain */ + uint sharpDepth; /* array/object initializer depth */ + IntPtr sharpArray; /* scope for #n= initializer vars */ + uint flags; /* frame flags -- see below */ + IntPtr dormantNext; /* next dormant frame chain */ + IntPtr xmlNamespace; /* null or default xml namespace in E4X */ + IntPtr blockChain; /* active compile-time block scopes */ + + IntPtr pcDisabledSave; // reserved for debug use + } + #endif + #endregion + + #region Native Members + + [DllImport("js3250", CharSet=CharSet.Ansi)] + static extern IntPtr JS_CompileScriptForPrincipals(IntPtr aJSContext, IntPtr aJSObject, IntPtr aJSPrincipals, string bytes, int length, string filename, int lineNumber); + + [DllImport("js3250")] + static extern IntPtr JS_GetGlobalObject(IntPtr aJSContext); + + [DllImport("js3250")] + static extern IntPtr JS_NewContext(IntPtr aJSRuntime, int stackchunksize); + + [DllImport("js3250")] + static extern void JS_DestroyContextNoGC(IntPtr cx); + + [DllImport("js3250")] + static extern IntPtr JS_BeginRequest(IntPtr cx); + + [DllImport("js3250")] + static extern IntPtr JS_EndRequest(IntPtr cx); + #endregion + + public AutoJSContext() + { + // obtain the JS runtime used by gecko + nsIJSRuntimeService runtimeService = (nsIJSRuntimeService)Xpcom.GetService("@mozilla.org/js/xpc/RuntimeService;1"); + IntPtr jsRuntime = runtimeService.GetRuntime(); + + // create a new JSContext + cx = JS_NewContext(jsRuntime, 8192); + + // begin a new request + JS_BeginRequest(cx); + + // push the context onto the context stack + nsIJSContextStack contextStack = Xpcom.GetService<nsIJSContextStack>("@mozilla.org/js/xpc/ContextStack;1"); + contextStack.Push(cx); + + // obtain the system principal (no security checks) which we will use when compiling the empty script below + nsIPrincipal system = Xpcom.GetService<nsIScriptSecurityManager>("@mozilla.org/scriptsecuritymanager;1").GetSystemPrincipal(); + IntPtr jsPrincipals = system.GetJSPrincipals(cx); + + // create a fake stack frame + JSStackFrame frame = new JSStackFrame(); + frame.script = JS_CompileScriptForPrincipals(cx, JS_GetGlobalObject(cx), jsPrincipals, "", 0, "", 1); + + // put a pointer to the fake stack frame on the JSContext + + // frame.down = cx->fp + IntPtr old = Marshal.ReadIntPtr(cx, OfsetOfFP); + frame.down = old; + + IntPtr framePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(JSStackFrame))); + Marshal.StructureToPtr(frame, framePtr, true); + + // cx->fp = framePtr; + Marshal.WriteIntPtr(cx, OfsetOfFP, framePtr); + } + + //NOTE: these hard-coded field offsets are based on the unmanaged layout of JSContext objects. this will + // probably not work for versions other than 1.8, 1.9 and 1.9.1 + #if GECKO_1_9_1 + const int OfsetOfFP = 0x98; + #elif GECKO_1_9 + const int OfsetOfFP = 0x54; + #elif GECKO_1_8 + const int OfsetOfFP = 0x34; + #endif + + IntPtr cx; + public void Dispose() { - _securityManager.PopContextPrincipal(_cx); + nsIJSContextStack contextStack = Xpcom.GetService<nsIJSContextStack>("@mozilla.org/js/xpc/ContextStack;1"); + contextStack.Pop(); - _contextStack.Pop(); - SpiderMonkey.JS_EndRequest(_cx); + // free the memory allocated for the fake stack frame + Marshal.FreeHGlobal(Marshal.ReadIntPtr(cx, OfsetOfFP)); + + // end the request, destroy the context + JS_EndRequest(cx); + JS_DestroyContextNoGC(cx); } } } Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/BaseNsFactory.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/BaseNsFactory.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/BaseNsFactory.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; - -namespace Gecko -{ - public class BaseNsFactory<TFactory> - where TFactory:nsIFactory, new() - { - // If you are using resharper it will generate warning because - // BaseNsFactory<T1>._isRegistered and BaseNsFactory<T2>._isRegistered are different fields - // but for us this is good :) -// ReSharper disable StaticFieldInGenericType - private static bool _isRegistered; - private static string _contractID; - private static string _factoryTypeName; -// ReSharper restore StaticFieldInGenericType - - protected BaseNsFactory() - { - - } - - /// <summary> - /// Registration by default (using ContractIDAttribute) - /// </summary> - public static void Register() - { - if (_isRegistered) return; - - var factoryType = typeof (TFactory); - var attributes = factoryType.GetCustomAttributes( typeof (ContractIDAttribute), true ); - if (attributes.Length > 0) - { - ContractIDAttribute attribute = (ContractIDAttribute)attributes[ 0 ]; - _contractID = attribute.ContractID; - _factoryTypeName = factoryType.FullName; - try - { - Xpcom.RegisterFactory( - factoryType.GUID, - _factoryTypeName, - _contractID, - new TFactory()); - } - catch ( Exception ) - { - // - } - - _isRegistered = true; - } - } - - /// <summary> - /// Registration with given contractID - /// </summary> - /// <param name="contractID"></param> - public static void Register(string contractID) - { - if ( _isRegistered ) return; - - var factoryType = typeof (TFactory); - _factoryTypeName = factoryType.FullName; - Xpcom.RegisterFactory(factoryType.GUID,_factoryTypeName,_contractID,new TFactory() ); - _contractID = contractID; - _isRegistered = true; - } - - /// <summary> - /// Returns ContractID if registered or null if not registered. - /// </summary> - /// <returns></returns> - public static string GetContractID() - { - return _contractID; - } - - public static string GetFactoryTypeName() - { - return _factoryTypeName; - } - } - - public sealed class ContractIDAttribute - :Attribute - { - public readonly string ContractID; - - public ContractIDAttribute(string contractID) - { - ContractID = contractID; - } - } - - public class GenericOneClassNsFactory<TFactory,TType> - : BaseNsFactory<TFactory>,nsIFactory - where TFactory:nsIFactory, new() - where TType:new() - { - - protected virtual IntPtr Create( nsISupports aOuter, ref Guid iid ) - { - IntPtr result = IntPtr.Zero; - IntPtr iUnknownForObject = Marshal.GetIUnknownForObject(new TType()); - Marshal.QueryInterface(iUnknownForObject, ref iid, out result); - Marshal.Release(iUnknownForObject); - return result; - } - - public IntPtr CreateInstance( nsISupports aOuter, ref Guid iid ) - { - return Create( aOuter, ref iid ); - } - - public void LockFactory( bool @lock ) - { - - } - } - -} Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ByteArrayInputStream.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ByteArrayInputStream.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ByteArrayInputStream.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,84 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Gecko -{ - /// <summary> - /// Streams a byte array using nsIInputStream. - /// </summary> - #region class ByteArrayInputStream : nsIInputStream - public class ByteArrayInputStream : nsIInputStream - { - private ByteArrayInputStream(byte[] data) - { - Data = data; - } - - public static ByteArrayInputStream Create(byte[] data) - { - return (data == null) ? null : new ByteArrayInputStream(data); - } - - byte[] Data; - int Position; - - #region nsIInputStream Members - - public void Close() - { - // do nothing - } - - public uint Available() - { - return (uint)(Data.Length - Position); - } - - public uint Read(IntPtr aBuf, uint aCount) - { - uint count = Math.Min(aCount, Available()); - - if (count > 0) - { - Marshal.Copy(Data, Position, aBuf, (int)count); -#if DEBUG - for (int i = 0; i < count; ++i) - { - Console.WriteLine((char)Marshal.ReadByte(aBuf, i)); - } -#endif - Position += (int)count; - } - - return count; - } - - public unsafe uint ReadSegments(nsWriteSegmentFun aWriter, IntPtr aClosure, uint aCount) - { - int length = (int)Math.Min(aCount, Available()); - int writeCount = 0; - - if (length > 0) - { - nsWriteSegmentFun fun = aWriter; - - fixed (byte* data = &Data[Position]) - { - fun(this, aClosure, (IntPtr)data, Position, length, out writeCount); - } - - Position += writeCount; - } - - return (uint)writeCount; - } - - public bool IsNonBlocking() - { - return true; - } - - #endregion - } - #endregion - } \ No newline at end of file Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.Designer.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.Designer.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.Designer.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,4 +1,4 @@ -namespace Gecko +namespace Skybound.Gecko { partial class ChromeDialog { @@ -28,21 +28,19 @@ /// </summary> private void InitializeComponent() { - this.webBrowser = new Gecko.GeckoWebBrowser(); + this.webBrowser = new Skybound.Gecko.GeckoWebBrowser(); this.SuspendLayout(); // // webBrowser // - this.webBrowser.DisableWmImeSetContext = false; this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill; this.webBrowser.Location = new System.Drawing.Point(0, 0); this.webBrowser.Name = "webBrowser"; this.webBrowser.Size = new System.Drawing.Size(500, 353); this.webBrowser.TabIndex = 0; - this.webBrowser.UseHttpActivityObserver = false; - this.webBrowser.WindowClosed += new System.EventHandler(this.webBrowser_WindowClosed); - this.webBrowser.WindowSetBounds += new System.EventHandler<Gecko.GeckoWindowSetBoundsEventArgs>(this.webBrowser_WindowSetBounds); + this.webBrowser.WindowSetBounds += new Skybound.Gecko.GeckoWindowSetBoundsEventHandler(this.webBrowser_WindowSetBounds); this.webBrowser.DocumentTitleChanged += new System.EventHandler(this.webBrowser_DocumentTitleChanged); + this.webBrowser.WindowClosed += new System.EventHandler(this.webBrowser_WindowClosed); // // ChromeDialog // Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -6,7 +6,7 @@ using System.Text; using System.Windows.Forms; -namespace Gecko +namespace Skybound.Gecko { public partial class ChromeDialog : Form { @@ -34,6 +34,5 @@ { this.Close(); } - } } \ No newline at end of file Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ChromeDialog.resources =================================================================== (Binary files differ) Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.Designer.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.Designer.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.Designer.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,7 +1,7 @@ using System.Windows.Forms; using System.ComponentModel; using System.Drawing; -namespace Gecko +namespace Skybound.Gecko { partial class ConfirmDialog { Modified: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -38,7 +38,7 @@ using System.Drawing; using System.Windows.Forms; -namespace Gecko +namespace Skybound.Gecko { partial class ConfirmDialog : Form { Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConfirmDialog.resources =================================================================== (Binary files differ) Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConsoleMessageEventArgs.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConsoleMessageEventArgs.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/ConsoleMessageEventArgs.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Gecko -{ - public class ConsoleMessageEventArgs : EventArgs - { - public string Message { get; protected set; } - - public ConsoleMessageEventArgs( string message ) - { - Message = message; - } - } -} Deleted: trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Contracts.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Contracts.cs 2012-07-16 20:51:13 UTC (rev 4505) +++ trunk/plugins/BrowseTheWeb/Source/Skybound.Gecko/Contracts.cs 2012-07-26 21:25:33 UTC (rev 4506) @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Gecko -{ - public static class Contracts - { - #region contracts for elements that HAVE wrappers - #region Network - internal static readonly string DnsService = "@mozilla.org/network/dns-service;1"; - internal static readonly string StreamListenerTee = "@mozilla.org/network/stream-listener-tee;1"; - public static readonly string CacheService = "@mozilla.org/network/cache-service;1"; - public static readonly string NetworkIOService = "@mozilla.org/network/io-service;1"; - internal static readonly string HttpActivityDistributor = "@mozilla.org/network/http-activity-distributor;1"; - #endregion - #region Security - public static readonly string X509CertDb = "@mozilla.org/security/x509certdb;1"; - public static readonly string RandomGenerator = "@mozilla.org/security/random-generator;1"; - public static readonly string KeyObjectFactory = "@mozilla.org/security/keyobjectfactory;1"; - public static readonly string Hash = "@mozilla.org/security/hash;1"; - #endregion - #region AppShell - public static readonly string AppShellService = "@mozilla.org/appshell/appShellService;1"; - public static readonly string WindowMediator = "@mozilla.org/appshell/window-mediator;1"; - #endregion - #region Image - public static readonly string ImageCache = "@mozilla.org/image/cache;1"; - public static readonly string ImageContainer = "@mozilla.org/image/container;1"; - #endregion - - public static readonly string WindowWatcher = "@mozilla.org/embedcomp/window-watcher;1"; - public static readonly string WritableVariant = "@mozilla.org/variant;1"; - public static readonly string ... [truncated message content] |