/// <summary>Creates a new instance of a <see cref="GeckoNavigatingEventArgs"/> object.</summary>
 /// <param name="value"></param>
 public GeckoNavigatingEventArgs(Uri value, GeckoWindow domWind)
 {
     Uri = value;
     DomWindow = domWind;
     DomWindowTopLevel = GeckoWindowExtension.IsTopWindow(domWind);
     // domWind.IsTopWindow();
 }
Пример #2
0
        private void Procedure(Uri uri, GeckoWindow window, String file)
        {
            try
            {
                Action <FlowModelData> action;
                String next;
                Action <FlowModelData> callback;
                flow.Procedure(uri, out action, out next, out callback);
                if (window != null)
                {
                    GeckoElement script = this.Document.CreateElement("script");
                    script.SetAttribute("type", "text/javascript");
                    script.TextContent = "window.alert = function(){};";
                    window.Document.OwnerDocument.Head.AppendChild(script);
                    using (AutoJSContext context = new AutoJSContext(this.Window))
                    {
                        string result;
                        context.EvaluateScript("window.alert = function(){};", (nsISupports)window.DomWindow, out result);
                    }
                    flowModelData.Document = window.Document.OwnerDocument;
                }
                flowModelData.Uri          = uri;
                flowModelData.NextUrl      = next;
                flowModelData.CallBack     = callback;
                flowModelData.IsNextScrap  = true;
                flowModelData.IsSkipAction = false;
                if (file != null)
                {
                    flowModelData.File = new FileInfo(file);
                }
                action(flowModelData);
                if (flowModelData.IsSkipAction)
                {
                    return;
                }
                if (flowModelData.CallBack != null)
                {
                    flowModelData.CallBack(flowModelData);
                }
                if (!String.IsNullOrEmpty(flowModelData.NextUrl))
                {
                    this.Navigate(flowModelData.NextUrl);
                }
                if (!flowModelData.IsNextScrap)
                {
                    //resultParameter.Endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
                    flow.End(flowModelData);
                    Scraper.Exit();
                }
            }
            catch (Exception ex)
            {
                //resultParameter.ResultCD = "9999";
                //resultParameter.ResultMSG = ex.ToString();

                flow.Error(ex);
                logger.Error(ex.ToString());
                Scraper.Exit();
            }
        }
		/// <summary>Creates a new instance of a <see cref="GeckoNavigatedEventArgs"/> object.</summary>
		/// <param name="value"></param>
		/// <param name="response"></param>
		internal GeckoNavigationErrorEventArgs(string uri, GeckoWindow domWind, int errorCode)
		{
			Uri = uri;
			DomWindow = domWind;
			DomWindowTopLevel = (domWind == null) || domWind.IsTopWindow();
			ErrorCode = errorCode;
		}
Пример #4
0
 /// <summary>Creates a new instance of a <see cref="GeckoNavigatedEventArgs"/> object.</summary>
 /// <param name="value"></param>
 /// <param name="response"></param>
 internal GeckoNavigationErrorEventArgs(string uri, GeckoWindow domWind, int errorCode)
 {
     Uri               = uri;
     DomWindow         = domWind;
     DomWindowTopLevel = (domWind == null) || domWind.IsTopWindow();
     ErrorCode         = errorCode;
 }
 /// <summary>
 /// Unittest helper method to create a String JsVal
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 private static JsVal CreateJsVal(GeckoWindow window, string jscript)
 {
     using (AutoJSContext cx = new AutoJSContext(window))
     {
         return(CreateJsVal(window, cx, jscript));
     }
 }
        private static JsVal CreateJsVal(GeckoWindow window, AutoJSContext cx, string jscript)
        {
            if (cx == null)
            {
                return(CreateJsVal(window, jscript));
            }

            var  ptr = new JsVal();
            bool ret = SpiderMonkey.JS_EvaluateScript(cx.ContextPointer, jscript, (uint)jscript.Length, "script", 1, ref ptr);

            Assert.IsTrue(ret);
            return(ptr);
        }
Пример #7
0
 public void SetGroupIdForWindow(GeckoWindow aParent, string aIdentifier)
 {
     nsString.Set(x => _winTaskbar.Instance.SetGroupIdForWindow(aParent.DomWindow, x), aIdentifier);
 }
Пример #8
0
		public void SetGroupIdForWindow(GeckoWindow aParent, string aIdentifier)
		{
			nsString.Set(x => _winTaskbar.Instance.SetGroupIdForWindow(aParent.DomWindow, x), aIdentifier);
		}
Пример #9
0
 public GeckoDocumentCompletedEventArgs(Uri uri, GeckoWindow window)
 {
     this.Uri        = uri;
     this.Window     = window;
     this.IsTopLevel = window.IsTopWindow();
 }
Пример #10
0
		public JQueryExecutor(GeckoWindow window)
		{
			m_Window = window;
		}
		public GeckoDocumentCompletedEventArgs(Uri uri, GeckoWindow window)
		{
			this.Uri = uri;
			this.Window = window;
			this.IsTopLevel = window.IsTopWindow();
		}
        internal static JsVal CreateStringJsVal(GeckoWindow window, AutoJSContext context, string value)
        {
            string jscript = String.Format("'{0}';", value);

            return(CreateJsVal(window, context, jscript));
        }
Пример #13
0
 public JQueryExecutor(GeckoWindow window)
 {
     _window = window;
 }
 /// <summary>Creates a new instance of a <see cref="GeckoNavigatingEventArgs"/> object.</summary>
 /// <param name="value"></param>
 public GeckoNavigatingEventArgs(Uri value, GeckoWindow domWind)
 {
     Uri       = value;
     DomWindow = domWind;
 }
Пример #15
0
 public void SetGroupIdForWindow(GeckoWindow aParent, string aIdentifier)
 {
     //nsString.Set(x => _winTaskbar.Instance.SetGroupIdForWindow(aParent.DomWindow, x), aIdentifier);
     throw new NotImplementedException();
 }
        /// <summary>
        /// Unittest helper method to create a bool JsVal
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        internal static JsVal CreateBoolJsVal(GeckoWindow window, bool value)
        {
            string jscript = String.Format("{0};", value ? "true" : "false");

            return(CreateJsVal(window, jscript));
        }
        /// <summary>
        /// Unittest helper method to create a Number JsVal
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        internal static JsVal CreateNumberJsVal(GeckoWindow window, int value)
        {
            string jscript = String.Format("{0};", value);

            return(CreateJsVal(window, jscript));
        }
Пример #18
0
 public GeckoDocumentCompletedEventArgs(Uri uri, GeckoWindow window)
 {
     this.Uri    = uri;
     this.Window = window;
 }
Пример #19
0
 /// <summary>
 /// Same as leaveModalState, but takes a window associated with the active
 /// context when enterModalStateWithWindow was called. The currently context
 /// might be different at the moment (see bug 621764).
 /// </summary>
 public void LeaveModalStateWithWindow(GeckoWindow aWindow)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Same as leaveModalState, but takes a window associated with the active
 /// context when enterModalStateWithWindow was called. The currently context
 /// might be different at the moment (see bug 621764).
 /// </summary>		
 public void LeaveModalStateWithWindow(GeckoWindow aWindow)
 {
     throw new NotImplementedException();
 }
Пример #21
0
 /// <summary>Creates a new instance of a <see cref="GeckoNavigatingEventArgs"/> object.</summary>
 /// <param name="value"></param>
 public GeckoNavigatingEventArgs(Uri value, GeckoWindow domWind)
 {
     Uri               = value;
     DomWindow         = domWind;
     DomWindowTopLevel = domWind.IsTopWindow();
 }
 /// <summary>Creates a new instance of a <see cref="GeckoNavigatedEventArgs"/> object.</summary>
 /// <param name="value"></param>
 /// <param name="response"></param>
 internal GeckoNavigationErrorEventArgs(string uri, GeckoWindow domWind, int errorCode)
 {
     Uri       = uri;
     DomWindow = domWind;
     ErrorCode = errorCode;
 }
Пример #23
0
 /// <summary>
 /// Same as leaveModalState, but takes a window associated with the active
 /// context when enterModalStateWithWindow was called. The currently context
 /// might be different at the moment (see bug 621764).
 /// </summary>		
 public void LeaveModalStateWithWindow(GeckoWindow aWindow)
 {
     _windowUtils.Instance.LeaveModalStateWithWindow(aWindow.DomWindow);
 }
 /// <summary>Creates a new instance of a <see cref="GeckoRetargetedEventArgs"/> object.</summary>
 /// <param name="uri"></param>
 public GeckoRetargetedEventArgs(Uri uri, GeckoWindow domWind, Request req)
 {
     Uri       = uri;
     DomWindow = domWind;
     Request   = req;
 }
Пример #25
0
 /// <summary>
 /// Same as leaveModalState, but takes a window associated with the active
 /// context when enterModalStateWithWindow was called. The currently context
 /// might be different at the moment (see bug 621764).
 /// </summary>
 public void LeaveModalStateWithWindow(GeckoWindow aWindow)
 {
     _windowUtils.Instance.LeaveModalStateWithWindow(aWindow.DomWindow);
 }