Mercurial > projects > dwt-linux
comparison dwt/browser/Mozilla.d @ 350:373b48b9eaf0
Conclusion of long painful debugging: working Browser package :) (aplha)
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Sun, 02 Nov 2008 01:30:09 -0800 |
parents | 9a4d7706df52 |
children | a3c5f744d03f |
comparison
equal
deleted
inserted
replaced
349:676785ef6d24 | 350:373b48b9eaf0 |
---|---|
13 module dwt.browser.Mozilla; | 13 module dwt.browser.Mozilla; |
14 | 14 |
15 import dwt.dwthelper.utils; | 15 import dwt.dwthelper.utils; |
16 | 16 |
17 import tango.text.locale.Core; // Necessary for Region/Culture/Locale code | 17 import tango.text.locale.Core; // Necessary for Region/Culture/Locale code |
18 import tango.io.Stdout; | |
18 import tango.text.convert.Format; | 19 import tango.text.convert.Format; |
19 import tango.io.Console; | 20 import tango.io.Console; |
20 import tango.sys.Environment; | 21 import tango.sys.Environment; |
21 import tango.stdc.string; | 22 import tango.stdc.string; |
22 | 23 |
75 import dwt.internal.mozilla.nsIDOMWindow; | 76 import dwt.internal.mozilla.nsIDOMWindow; |
76 import dwt.internal.mozilla.nsIDOMWindowCollection; | 77 import dwt.internal.mozilla.nsIDOMWindowCollection; |
77 import dwt.internal.mozilla.nsIDOMDocument; | 78 import dwt.internal.mozilla.nsIDOMDocument; |
78 import dwt.internal.mozilla.nsIDirectoryService; | 79 import dwt.internal.mozilla.nsIDirectoryService; |
79 import dwt.internal.mozilla.nsIDocShell; | 80 import dwt.internal.mozilla.nsIDocShell; |
80 //import dwt.internal.mozilla.nsIDocShell_1_8; | |
81 //import dwt.internal.mozilla.nsIDocShell_1_9; | |
82 import dwt.internal.mozilla.nsIEmbeddingSiteWindow; | 81 import dwt.internal.mozilla.nsIEmbeddingSiteWindow; |
83 import dwt.internal.mozilla.nsIFile; | 82 import dwt.internal.mozilla.nsIFile; |
84 import dwt.internal.mozilla.nsIFactory; | 83 import dwt.internal.mozilla.nsIFactory; |
85 import dwt.internal.mozilla.nsIIOService; | 84 import dwt.internal.mozilla.nsIIOService; |
86 import dwt.internal.mozilla.nsIInterfaceRequestor; | 85 import dwt.internal.mozilla.nsIInterfaceRequestor; |
94 import dwt.internal.mozilla.nsIRequest; | 93 import dwt.internal.mozilla.nsIRequest; |
95 import dwt.internal.mozilla.nsIServiceManager; | 94 import dwt.internal.mozilla.nsIServiceManager; |
96 import dwt.internal.mozilla.nsISimpleEnumerator; | 95 import dwt.internal.mozilla.nsISimpleEnumerator; |
97 import dwt.internal.mozilla.nsIStreamListener; | 96 import dwt.internal.mozilla.nsIStreamListener; |
98 import dwt.internal.mozilla.nsISupports; | 97 import dwt.internal.mozilla.nsISupports; |
99 //import dwt.internal.mozilla.nsISupportsWeakReference; | |
100 import dwt.internal.mozilla.nsITooltipListener; | 98 import dwt.internal.mozilla.nsITooltipListener; |
101 import dwt.internal.mozilla.nsIURI; | 99 import dwt.internal.mozilla.nsIURI; |
102 import dwt.internal.mozilla.nsIURIContentListener; | 100 import dwt.internal.mozilla.nsIURIContentListener; |
103 import dwt.internal.mozilla.nsIWeakReference; | 101 import dwt.internal.mozilla.nsIWeakReference; |
104 import dwt.internal.mozilla.nsIWebBrowser; | 102 import dwt.internal.mozilla.nsIWebBrowser; |
193 static final String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$ | 191 static final String XULRUNNER_PATH = "dwt.browser.XULRunnerPath"; //$NON-NLS-1$ |
194 | 192 |
195 // TEMPORARY CODE | 193 // TEMPORARY CODE |
196 static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$ | 194 static final String GRE_INITIALIZED = "dwt.browser.XULRunnerInitialized"; //$NON-NLS-1$ |
197 | 195 |
198 static this () { | 196 this () { |
199 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; | 197 PROFILE_DIR = SEPARATOR_OS ~ "eclipse" ~ SEPARATOR_OS; |
200 MozillaClearSessions = new class() Runnable { | 198 MozillaClearSessions = new class() Runnable { |
201 public void run () { | 199 public void run () { |
202 if (!Initialized) return; | 200 if (!Initialized) return; |
203 nsIServiceManager serviceManager; | 201 nsIServiceManager serviceManager; |
204 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | 202 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
205 if (rc !is XPCOM.NS_OK) error (rc); | 203 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
206 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); | 204 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
207 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 205 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
208 //result[0] = 0; | 206 //result[0] = 0; |
209 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true); | 207 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_COOKIEMANAGER_CONTRACTID, true); |
210 nsICookieManager manager; | 208 nsICookieManager manager; |
211 rc = serviceManager.GetServiceByContractID (XPCOM.NS_COOKIEMANAGER_CONTRACTID.ptr, &nsICookieManager.IID, cast(void**)&manager); | 209 rc = serviceManager.GetServiceByContractID (XPCOM.NS_COOKIEMANAGER_CONTRACTID.ptr, &nsICookieManager.IID, cast(void**)&manager); |
212 if (rc !is XPCOM.NS_OK) error (rc); | 210 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
213 if (manager is null) error (XPCOM.NS_NOINTERFACE); | 211 if (manager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
214 serviceManager.Release (); | 212 serviceManager.Release (); |
215 | 213 |
216 //nsICookieManager manager = new nsICookieManager (result[0]); | 214 //nsICookieManager manager = new nsICookieManager (result[0]); |
217 //result[0] = 0; | 215 //result[0] = 0; |
218 nsISimpleEnumerator enumerator; | 216 nsISimpleEnumerator enumerator; |
219 rc = manager.GetEnumerator (&enumerator); | 217 rc = manager.GetEnumerator (&enumerator); |
220 if (rc !is XPCOM.NS_OK) error (rc); | 218 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
221 manager.Release (); | 219 manager.Release (); |
222 | 220 |
223 //nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]); | 221 //nsISimpleEnumerator enumerator = new nsISimpleEnumerator (result[0]); |
224 PRBool moreElements; /* PRBool */ | 222 PRBool moreElements; /* PRBool */ |
225 rc = enumerator.HasMoreElements (&moreElements); | 223 rc = enumerator.HasMoreElements (&moreElements); |
226 if (rc !is XPCOM.NS_OK) error (rc); | 224 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
227 while (moreElements !is 0) { | 225 while (moreElements !is 0) { |
228 //result[0] = 0; | 226 //result[0] = 0; |
229 nsICookie cookie; | 227 nsICookie cookie; |
230 rc = enumerator.GetNext (cast(nsISupports*)&cookie); | 228 rc = enumerator.GetNext (cast(nsISupports*)&cookie); |
231 if (rc !is XPCOM.NS_OK) error (rc); | 229 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
232 //nsICookie cookie = new nsICookie (result[0]); | 230 //nsICookie cookie = new nsICookie (result[0]); |
233 PRUint64 expires; | 231 PRUint64 expires; |
234 rc = cookie.GetExpires (&expires); | 232 rc = cookie.GetExpires (&expires); |
235 if (expires is 0) { | 233 if (expires is 0) { |
236 /* indicates a session cookie */ | 234 /* indicates a session cookie */ |
242 cookie.GetPath (cast(nsACString*)path); | 240 cookie.GetPath (cast(nsACString*)path); |
243 rc = manager.Remove (cast(nsACString*)domain, cast(nsACString*)name, cast(nsACString*)path, 0); | 241 rc = manager.Remove (cast(nsACString*)domain, cast(nsACString*)name, cast(nsACString*)path, 0); |
244 //XPCOM.nsEmbedCString_delete (domain); | 242 //XPCOM.nsEmbedCString_delete (domain); |
245 //XPCOM.nsEmbedCString_delete (name); | 243 //XPCOM.nsEmbedCString_delete (name); |
246 //XPCOM.nsEmbedCString_delete (path); | 244 //XPCOM.nsEmbedCString_delete (path); |
247 if (rc !is XPCOM.NS_OK) error (rc); | 245 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
248 } | 246 } |
249 cookie.Release (); | 247 cookie.Release (); |
250 rc = enumerator.HasMoreElements (&moreElements); | 248 rc = enumerator.HasMoreElements (&moreElements); |
251 if (rc !is XPCOM.NS_OK) error (rc); | 249 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
252 } | 250 } |
253 enumerator.Release (); | 251 enumerator.Release (); |
254 } | 252 } |
255 }; | 253 }; |
256 } | 254 } |
378 byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); | 376 byte[] path = MozillaDelegate.wcsToMbcs (null, mozillaPath, true); |
379 int rc = XPCOM.XPCOMGlueStartup (path); | 377 int rc = XPCOM.XPCOMGlueStartup (path); |
380 | 378 |
381 if (rc !is XPCOM.NS_OK) { | 379 if (rc !is XPCOM.NS_OK) { |
382 browser.dispose (); | 380 browser.dispose (); |
383 error (rc); | 381 error (rc, __FILE__, __LINE__); |
384 } | 382 } |
385 +/ // No need for double layer initialization in DWT; XPCOMInit was glued | 383 +/ // No need for double layer initialization in DWT; XPCOMInit was glued |
386 // At this stage we know that XULRunner is available, but we don't know | 384 // At this stage we know that XULRunner is available, but we don't know |
387 // TODO: determine if | 385 // TODO: determine if |
388 XPCOMWasGlued = true; | 386 XPCOMWasGlued = true; |
452 scope auto pathString = new nsEmbedString (mozillaPath.toString16()); | 450 scope auto pathString = new nsEmbedString (mozillaPath.toString16()); |
453 nsresult rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); | 451 nsresult rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); |
454 //pathString.dispose (); | 452 //pathString.dispose (); |
455 if (rc !is XPCOM.NS_OK) { | 453 if (rc !is XPCOM.NS_OK) { |
456 browser.dispose (); | 454 browser.dispose (); |
457 error (rc); | 455 error (rc, __FILE__, __LINE__); |
458 } | 456 } |
459 if (localFile is null) { | 457 if (localFile is null) { |
460 browser.dispose (); | 458 browser.dispose (); |
461 error (XPCOM.NS_ERROR_NULL_POINTER); | 459 error (XPCOM.NS_ERROR_NULL_POINTER); |
462 } | 460 } |
514 +/ | 512 +/ |
515 nsIComponentManager componentManager; | 513 nsIComponentManager componentManager; |
516 int rc = XPCOM.NS_GetComponentManager (&componentManager); | 514 int rc = XPCOM.NS_GetComponentManager (&componentManager); |
517 if (rc !is XPCOM.NS_OK) { | 515 if (rc !is XPCOM.NS_OK) { |
518 browser.dispose (); | 516 browser.dispose (); |
519 error (rc); | 517 error (rc, __FILE__, __LINE__); |
520 } | 518 } |
521 if (componentManager is null) { | 519 if (componentManager is null) { |
522 browser.dispose (); | 520 browser.dispose (); |
523 error (XPCOM.NS_NOINTERFACE); | 521 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
524 } | 522 } |
525 | 523 |
526 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); | 524 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
527 //result[0] = 0; | 525 //result[0] = 0; |
528 if (mozDelegate.needsSpinup ()) { | 526 if (mozDelegate.needsSpinup ()) { |
529 /* nsIAppShell is discontinued as of xulrunner 1.9, so do not fail if it is not found */ | 527 /* nsIAppShell is discontinued as of xulrunner 1.9, so do not fail if it is not found */ |
530 rc = componentManager.CreateInstance (&XPCOM.NS_APPSHELL_CID, null, &nsIAppShell.IID, cast(void**)&AppShell); | 528 rc = componentManager.CreateInstance (&XPCOM.NS_APPSHELL_CID, null, &nsIAppShell.IID, cast(void**)&AppShell); |
531 if (rc !is XPCOM.NS_ERROR_NO_INTERFACE) { | 529 if (rc !is XPCOM.NS_ERROR_NO_INTERFACE) { |
532 if (rc !is XPCOM.NS_OK) { | 530 if (rc !is XPCOM.NS_OK) { |
533 browser.dispose (); | 531 browser.dispose (); |
534 error (rc); | 532 error (rc, __FILE__, __LINE__); |
535 } | 533 } |
536 if (AppShell is null) { | 534 if (AppShell is null) { |
537 browser.dispose (); | 535 browser.dispose (); |
538 error (XPCOM.NS_NOINTERFACE); | 536 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
539 } | 537 } |
540 | 538 |
541 //AppShell = new nsIAppShell (result[0]); | 539 //AppShell = new nsIAppShell (result[0]); |
542 rc = AppShell.Create (null, null); | 540 rc = AppShell.Create (null, null); |
543 if (rc !is XPCOM.NS_OK) { | 541 if (rc !is XPCOM.NS_OK) { |
544 browser.dispose (); | 542 browser.dispose (); |
545 error (rc); | 543 error (rc, __FILE__, __LINE__); |
546 } | 544 } |
547 rc = AppShell.Spinup (); | 545 rc = AppShell.Spinup (); |
548 if (rc !is XPCOM.NS_OK) { | 546 if (rc !is XPCOM.NS_OK) { |
549 browser.dispose (); | 547 browser.dispose (); |
550 error (rc); | 548 error (rc, __FILE__, __LINE__); |
551 } | 549 } |
552 } | 550 } |
553 //result[0] = 0; | 551 //result[0] = 0; |
554 } | 552 } |
555 | 553 |
558 | 556 |
559 nsIServiceManager serviceManager; | 557 nsIServiceManager serviceManager; |
560 rc = XPCOM.NS_GetServiceManager (&serviceManager); | 558 rc = XPCOM.NS_GetServiceManager (&serviceManager); |
561 if (rc !is XPCOM.NS_OK) { | 559 if (rc !is XPCOM.NS_OK) { |
562 browser.dispose (); | 560 browser.dispose (); |
563 error (rc); | 561 error (rc, __FILE__, __LINE__); |
564 } | 562 } |
565 if (serviceManager is null) { | 563 if (serviceManager is null) { |
566 browser.dispose (); | 564 browser.dispose (); |
567 error (XPCOM.NS_NOINTERFACE); | 565 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
568 } | 566 } |
569 | 567 |
570 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 568 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
571 //result[0] = 0; | 569 //result[0] = 0; |
572 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); | 570 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WINDOWWATCHER_CONTRACTID, true); |
573 nsIWindowWatcher windowWatcher; | 571 nsIWindowWatcher windowWatcher; |
574 rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID.ptr, &nsIWindowWatcher.IID, cast(void**)&windowWatcher); | 572 rc = serviceManager.GetServiceByContractID (XPCOM.NS_WINDOWWATCHER_CONTRACTID.ptr, &nsIWindowWatcher.IID, cast(void**)&windowWatcher); |
575 if (rc !is XPCOM.NS_OK) { | 573 if (rc !is XPCOM.NS_OK) { |
576 browser.dispose (); | 574 browser.dispose (); |
577 error (rc); | 575 error (rc, __FILE__, __LINE__); |
578 } | 576 } |
579 if (windowWatcher is null) { | 577 if (windowWatcher is null) { |
580 browser.dispose (); | 578 browser.dispose (); |
581 error (XPCOM.NS_NOINTERFACE); | 579 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
582 } | 580 } |
583 | 581 |
584 //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); | 582 //nsIWindowWatcher windowWatcher = new nsIWindowWatcher (result[0]); |
585 //result[0] = 0; | 583 //result[0] = 0; |
586 rc = windowWatcher.SetWindowCreator (cast(nsIWindowCreator)WindowCreator); | 584 rc = windowWatcher.SetWindowCreator (cast(nsIWindowCreator)WindowCreator); |
587 if (rc !is XPCOM.NS_OK) { | 585 if (rc !is XPCOM.NS_OK) { |
588 browser.dispose (); | 586 browser.dispose (); |
589 error (rc); | 587 error (rc, __FILE__, __LINE__); |
590 } | 588 } |
591 windowWatcher.Release (); | 589 windowWatcher.Release (); |
592 | 590 |
593 /* compute the profile directory and set it on the AppFileLocProvider */ | 591 /* compute the profile directory and set it on the AppFileLocProvider */ |
594 if (LocationProvider !is null) { | 592 if (LocationProvider !is null) { |
595 nsIDirectoryService directoryService; | 593 nsIDirectoryService directoryService; |
596 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true); | 594 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DIRECTORYSERVICE_CONTRACTID, true); |
597 rc = serviceManager.GetServiceByContractID (XPCOM.NS_DIRECTORYSERVICE_CONTRACTID.ptr, &nsIDirectoryService.IID, cast(void**)&directoryService); | 595 rc = serviceManager.GetServiceByContractID (XPCOM.NS_DIRECTORYSERVICE_CONTRACTID.ptr, &nsIDirectoryService.IID, cast(void**)&directoryService); |
598 if (rc !is XPCOM.NS_OK) { | 596 if (rc !is XPCOM.NS_OK) { |
599 browser.dispose (); | 597 browser.dispose (); |
600 error (rc); | 598 error (rc, __FILE__, __LINE__); |
601 } | 599 } |
602 if (directoryService is null) { | 600 if (directoryService is null) { |
603 browser.dispose (); | 601 browser.dispose (); |
604 error (XPCOM.NS_NOINTERFACE); | 602 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
605 } | 603 } |
606 | 604 |
607 //nsIDirectoryService directoryService = new nsIDirectoryService (result[0]); | 605 //nsIDirectoryService directoryService = new nsIDirectoryService (result[0]); |
608 //result[0] = 0; | 606 //result[0] = 0; |
609 nsIProperties properties; | 607 nsIProperties properties; |
610 rc = directoryService.QueryInterface (&nsIProperties.IID, cast(void**)&properties); | 608 rc = directoryService.QueryInterface (&nsIProperties.IID, cast(void**)&properties); |
611 if (rc !is XPCOM.NS_OK) { | 609 if (rc !is XPCOM.NS_OK) { |
612 browser.dispose (); | 610 browser.dispose (); |
613 error (rc); | 611 error (rc, __FILE__, __LINE__); |
614 } | 612 } |
615 if (properties is null) { | 613 if (properties is null) { |
616 browser.dispose (); | 614 browser.dispose (); |
617 error (XPCOM.NS_NOINTERFACE); | 615 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
618 } | 616 } |
619 directoryService.Release (); | 617 directoryService.Release (); |
620 | 618 |
621 //nsIProperties properties = new nsIProperties (result[0]); | 619 //nsIProperties properties = new nsIProperties (result[0]); |
622 //result[0] = 0; | 620 //result[0] = 0; |
623 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true); | 621 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_APP_APPLICATION_REGISTRY_DIR, true); |
624 nsIFile profileDir; | 622 nsIFile profileDir; |
625 rc = properties.Get (XPCOM.NS_APP_APPLICATION_REGISTRY_DIR.ptr, &nsIFile.IID, cast(void**)&profileDir); | 623 rc = properties.Get (XPCOM.NS_APP_APPLICATION_REGISTRY_DIR.ptr, &nsIFile.IID, cast(void**)&profileDir); |
626 if (rc !is XPCOM.NS_OK) { | 624 if (rc !is XPCOM.NS_OK) { |
627 browser.dispose (); | 625 browser.dispose (); |
628 error (rc); | 626 error (rc, __FILE__, __LINE__); |
629 } | 627 } |
630 if (profileDir is null) { | 628 if (profileDir is null) { |
631 browser.dispose (); | 629 browser.dispose (); |
632 error (XPCOM.NS_NOINTERFACE); | 630 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
633 } | 631 } |
634 properties.Release (); | 632 properties.Release (); |
635 | 633 |
636 //nsIFile profileDir = new nsIFile (result[0]); | 634 //nsIFile profileDir = new nsIFile (result[0]); |
637 //result[0] = 0; | 635 //result[0] = 0; |
638 scope auto path = new nsEmbedCString; | 636 scope auto path = new nsEmbedCString; |
639 rc = profileDir.GetNativePath (cast(nsACString*)path); | 637 rc = profileDir.GetNativePath (cast(nsACString*)path); |
640 if (rc !is XPCOM.NS_OK) { | 638 if (rc !is XPCOM.NS_OK) { |
641 browser.dispose (); | 639 browser.dispose (); |
642 error (rc); | 640 error (rc, __FILE__, __LINE__); |
643 } | 641 } |
644 //int length = XPCOM.nsEmbedCString_Length (path); | 642 //int length = XPCOM.nsEmbedCString_Length (path); |
645 //int /*long*/ ptr = XPCOM.nsEmbedCString_get (path); | 643 //int /*long*/ ptr = XPCOM.nsEmbedCString_get (path); |
646 //buffer = new byte [length]; | 644 //buffer = new byte [length]; |
647 //XPCOM.memmove (buffer, ptr, length); | 645 //XPCOM.memmove (buffer, ptr, length); |
655 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); | 653 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); |
656 nsIObserverService observerService; | 654 nsIObserverService observerService; |
657 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); | 655 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); |
658 if (rc !is XPCOM.NS_OK) { | 656 if (rc !is XPCOM.NS_OK) { |
659 browser.dispose (); | 657 browser.dispose (); |
660 error (rc); | 658 error (rc, __FILE__, __LINE__); |
661 } | 659 } |
662 if (observerService is null) { | 660 if (observerService is null) { |
663 browser.dispose (); | 661 browser.dispose (); |
664 error (XPCOM.NS_NOINTERFACE); | 662 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
665 } | 663 } |
666 | 664 |
667 //nsIObserverService observerService = new nsIObserverService (result[0]); | 665 //nsIObserverService observerService = new nsIObserverService (result[0]); |
668 //result[0] = 0; | 666 //result[0] = 0; |
669 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true); | 667 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_DO_CHANGE, true); |
672 //STARTUP.getChars (0, length, chars, 0); | 670 //STARTUP.getChars (0, length, chars, 0); |
673 wchar* chars = STARTUP.toString16().toString16z(); | 671 wchar* chars = STARTUP.toString16().toString16z(); |
674 rc = observerService.NotifyObservers (null, PROFILE_DO_CHANGE.ptr, chars); | 672 rc = observerService.NotifyObservers (null, PROFILE_DO_CHANGE.ptr, chars); |
675 if (rc !is XPCOM.NS_OK) { | 673 if (rc !is XPCOM.NS_OK) { |
676 browser.dispose (); | 674 browser.dispose (); |
677 error (rc); | 675 error (rc, __FILE__, __LINE__); |
678 } | 676 } |
679 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true); | 677 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_AFTER_CHANGE, true); |
680 rc = observerService.NotifyObservers (null, PROFILE_AFTER_CHANGE.ptr, chars); | 678 rc = observerService.NotifyObservers (null, PROFILE_AFTER_CHANGE.ptr, chars); |
681 if (rc !is XPCOM.NS_OK) { | 679 if (rc !is XPCOM.NS_OK) { |
682 browser.dispose (); | 680 browser.dispose (); |
683 error (rc); | 681 error (rc, __FILE__, __LINE__); |
684 } | 682 } |
685 observerService.Release (); | 683 observerService.Release (); |
686 } | 684 } |
687 | 685 |
688 /* | 686 /* |
694 nsIPrefService prefService; | 692 nsIPrefService prefService; |
695 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); | 693 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); |
696 serviceManager.Release (); | 694 serviceManager.Release (); |
697 if (rc !is XPCOM.NS_OK) { | 695 if (rc !is XPCOM.NS_OK) { |
698 browser.dispose (); | 696 browser.dispose (); |
699 error (rc); | 697 error (rc, __FILE__, __LINE__); |
700 } | 698 } |
701 if (serviceManager is null) { | 699 if (serviceManager is null) { |
702 browser.dispose (); | 700 browser.dispose (); |
703 error (XPCOM.NS_NOINTERFACE); | 701 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
704 } | 702 } |
705 | 703 |
706 //nsIPrefService prefService = new nsIPrefService (result[0]); | 704 //nsIPrefService prefService = new nsIPrefService (result[0]); |
707 //result[0] = 0; | 705 //result[0] = 0; |
708 char[1] buffer = new char[1]; | 706 char[1] buffer = new char[1]; |
709 nsIPrefBranch prefBranch; | 707 nsIPrefBranch prefBranch; |
710 rc = prefService.GetBranch (buffer.ptr, &prefBranch); /* empty buffer denotes root preference level */ | 708 rc = prefService.GetBranch (buffer.ptr, &prefBranch); /* empty buffer denotes root preference level */ |
711 prefService.Release (); | 709 prefService.Release (); |
712 if (rc !is XPCOM.NS_OK) { | 710 if (rc !is XPCOM.NS_OK) { |
713 browser.dispose (); | 711 browser.dispose (); |
714 error (rc); | 712 error (rc, __FILE__, __LINE__); |
715 } | 713 } |
716 if (prefBranch is null) { | 714 if (prefBranch is null) { |
717 browser.dispose (); | 715 browser.dispose (); |
718 error (XPCOM.NS_NOINTERFACE); | 716 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
719 } | 717 } |
720 | 718 |
721 //nsIPrefBranch prefBranch = new nsIPrefBranch (result[0]); | 719 //nsIPrefBranch prefBranch = new nsIPrefBranch (result[0]); |
722 //result[0] = 0; | 720 //result[0] = 0; |
723 | 721 |
735 if (rc !is XPCOM.NS_OK) { | 733 if (rc !is XPCOM.NS_OK) { |
736 prefLocales = "en-us,en" ~ TOKENIZER_LOCALE; //$NON-NLS-1$ | 734 prefLocales = "en-us,en" ~ TOKENIZER_LOCALE; //$NON-NLS-1$ |
737 } else { | 735 } else { |
738 if (localizedString is null) { | 736 if (localizedString is null) { |
739 browser.dispose (); | 737 browser.dispose (); |
740 error (XPCOM.NS_NOINTERFACE); | 738 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
741 } | 739 } |
742 //localizedString = new nsIPrefLocalizedString (result[0]); | 740 //localizedString = new nsIPrefLocalizedString (result[0]); |
743 //result[0] = 0; | 741 //result[0] = 0; |
744 PRUnichar* tmpChars; | 742 PRUnichar* tmpChars; |
745 rc = localizedString.ToString (&tmpChars); | 743 rc = localizedString.ToString (&tmpChars); |
746 if (rc !is XPCOM.NS_OK) { | 744 if (rc !is XPCOM.NS_OK) { |
747 browser.dispose (); | 745 browser.dispose (); |
748 error (rc); | 746 error (rc, __FILE__, __LINE__); |
749 } | 747 } |
750 if (tmpChars is null) { | 748 if (tmpChars is null) { |
751 browser.dispose (); | 749 browser.dispose (); |
752 error (XPCOM.NS_NOINTERFACE); | 750 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
753 } | 751 } |
754 int span = XPCOM.strlen_PRUnichar (tmpChars); | 752 int span = XPCOM.strlen_PRUnichar (tmpChars); |
755 //char[] dest = new char[length]; | 753 //char[] dest = new char[length]; |
756 //XPCOM.memmove (dest, result[0], length * 2); | 754 //XPCOM.memmove (dest, result[0], length * 2); |
757 prefLocales = Utf.toString(tmpChars[0 .. span]) ~ TOKENIZER_LOCALE; | 755 prefLocales = Utf.toString(tmpChars[0 .. span]) ~ TOKENIZER_LOCALE; |
803 if (localizedString is null) { | 801 if (localizedString is null) { |
804 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); | 802 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
805 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); | 803 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
806 if (rc !is XPCOM.NS_OK) { | 804 if (rc !is XPCOM.NS_OK) { |
807 browser.dispose (); | 805 browser.dispose (); |
808 error (rc); | 806 error (rc, __FILE__, __LINE__); |
809 } | 807 } |
810 if (localizedString is null) { | 808 if (localizedString is null) { |
811 browser.dispose (); | 809 browser.dispose (); |
812 error (XPCOM.NS_NOINTERFACE); | 810 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
813 } | 811 } |
814 //localizedString = new nsIPrefLocalizedString (result[0]); | 812 //localizedString = new nsIPrefLocalizedString (result[0]); |
815 //result[0] = 0; | 813 //result[0] = 0; |
816 } | 814 } |
817 localizedString.SetDataWithLength (newLocales.length, newLocales.toString16().toString16z()); | 815 localizedString.SetDataWithLength (newLocales.length, newLocales.toString16().toString16z()); |
835 if (rc !is XPCOM.NS_OK) { | 833 if (rc !is XPCOM.NS_OK) { |
836 prefCharset = "ISO-8859-1"; //$NON_NLS-1$ | 834 prefCharset = "ISO-8859-1"; //$NON_NLS-1$ |
837 } else { | 835 } else { |
838 if (localizedString is null) { | 836 if (localizedString is null) { |
839 browser.dispose (); | 837 browser.dispose (); |
840 error (XPCOM.NS_NOINTERFACE); | 838 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
841 } | 839 } |
842 //localizedString = new nsIPrefLocalizedString (result[0]); | 840 //localizedString = new nsIPrefLocalizedString (result[0]); |
843 //result[0] = 0; | 841 //result[0] = 0; |
844 PRUnichar* tmpChar; | 842 PRUnichar* tmpChar; |
845 rc = localizedString.ToString (&tmpChar); | 843 rc = localizedString.ToString (&tmpChar); |
846 if (rc !is XPCOM.NS_OK) { | 844 if (rc !is XPCOM.NS_OK) { |
847 browser.dispose (); | 845 browser.dispose (); |
848 error (rc); | 846 error (rc, __FILE__, __LINE__); |
849 } | 847 } |
850 if (tmpChar is null) { | 848 if (tmpChar is null) { |
851 browser.dispose (); | 849 browser.dispose (); |
852 error (XPCOM.NS_NOINTERFACE); | 850 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
853 } | 851 } |
854 int span = XPCOM.strlen_PRUnichar (tmpChar); | 852 int span = XPCOM.strlen_PRUnichar (tmpChar); |
855 //char[] dest = new char[length]; | 853 //char[] dest = new char[length]; |
856 //XPCOM.memmove (dest, result[0], length * 2); | 854 //XPCOM.memmove (dest, result[0], length * 2); |
857 prefCharset = Utf.toString(tmpChar[0 .. span]); | 855 prefCharset = Utf.toString(tmpChar[0 .. span]); |
867 if (localizedString is null) { | 865 if (localizedString is null) { |
868 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); | 866 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
869 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); | 867 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
870 if (rc !is XPCOM.NS_OK) { | 868 if (rc !is XPCOM.NS_OK) { |
871 browser.dispose (); | 869 browser.dispose (); |
872 error (rc); | 870 error (rc, __FILE__, __LINE__); |
873 } | 871 } |
874 if (localizedString is null) { | 872 if (localizedString is null) { |
875 browser.dispose (); | 873 browser.dispose (); |
876 error (XPCOM.NS_NOINTERFACE); | 874 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
877 } | 875 } |
878 //localizedString = new nsIPrefLocalizedString (result[0]); | 876 //localizedString = new nsIPrefLocalizedString (result[0]); |
879 //result[0] = 0; | 877 //result[0] = 0; |
880 } | 878 } |
881 localizedString.SetDataWithLength (newCharset.length, newCharset.toString16().toString16z()); | 879 localizedString.SetDataWithLength (newCharset.length, newCharset.toString16().toString16z()); |
885 | 883 |
886 /* | 884 /* |
887 * Check for proxy values set as documented java properties and update mozilla's | 885 * Check for proxy values set as documented java properties and update mozilla's |
888 * preferences with these values if needed. | 886 * preferences with these values if needed. |
889 */ | 887 */ |
888 | |
889 // NOTE: in dwt, these properties don't exist so both keys will return null | |
890 String proxyHost = System.getProperty (PROPERTY_PROXYHOST); | 890 String proxyHost = System.getProperty (PROPERTY_PROXYHOST); |
891 String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); | 891 String proxyPortString = System.getProperty (PROPERTY_PROXYPORT); |
892 | 892 |
893 int port = -1; | 893 int port = -1; |
894 if (proxyPortString !is null) { | 894 if (proxyPortString !is null) { |
901 } | 901 } |
902 | 902 |
903 if (proxyHost !is null) { | 903 if (proxyHost !is null) { |
904 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); | 904 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID, true); |
905 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); | 905 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_PREFLOCALIZEDSTRING_CONTRACTID.ptr, null, &nsIPrefLocalizedString.IID, cast(void**)&localizedString); |
906 if (rc !is XPCOM.NS_OK) error (rc); | 906 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
907 if (localizedString is null) error (XPCOM.NS_NOINTERFACE); | 907 if (localizedString is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
908 | 908 |
909 //localizedString = new nsIPrefLocalizedString (result[0]); | 909 //localizedString = new nsIPrefLocalizedString (result[0]); |
910 //result[0] = 0; | 910 //result[0] = 0; |
911 //int length = proxyHost.length (); | 911 //int length = proxyHost.length (); |
912 //char[] charBuffer = new char[length + 1]; | 912 //char[] charBuffer = new char[length + 1]; |
913 //proxyHost.getChars (0, length, charBuffer, 0); | 913 //proxyHost.getChars (0, length, charBuffer, 0); |
914 rc = localizedString.SetDataWithLength (proxyHost.length, proxyHost.toString16().toString16z()); | 914 rc = localizedString.SetDataWithLength (proxyHost.length, proxyHost.toString16().toString16z()); |
915 if (rc !is XPCOM.NS_OK) error (rc); | 915 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
916 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_FTP, true); | 916 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_FTP, true); |
917 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_FTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); | 917 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_FTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
918 if (rc !is XPCOM.NS_OK) error (rc); | 918 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
919 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_HTTP, true); | 919 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_HTTP, true); |
920 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_HTTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); | 920 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_HTTP.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
921 if (rc !is XPCOM.NS_OK) error (rc); | 921 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
922 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_SSL, true); | 922 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYHOST_SSL, true); |
923 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_SSL.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); | 923 rc = prefBranch.SetComplexValue (PREFERENCE_PROXYHOST_SSL.ptr, &nsIPrefLocalizedString.IID, cast(nsISupports)localizedString); |
924 if (rc !is XPCOM.NS_OK) error (rc); | 924 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
925 localizedString.Release (); | 925 localizedString.Release (); |
926 } | 926 } |
927 | 927 |
928 if (port !is -1) { | 928 if (port !is -1) { |
929 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_FTP, true); | 929 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_FTP, true); |
930 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_FTP.ptr, port); | 930 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_FTP.ptr, port); |
931 if (rc !is XPCOM.NS_OK) error (rc); | 931 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
932 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_HTTP, true); | 932 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_HTTP, true); |
933 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_HTTP.ptr, port); | 933 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_HTTP.ptr, port); |
934 if (rc !is XPCOM.NS_OK) error (rc); | 934 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
935 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_SSL, true); | 935 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYPORT_SSL, true); |
936 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_SSL.ptr, port); | 936 rc = prefBranch.SetIntPref (PREFERENCE_PROXYPORT_SSL.ptr, port); |
937 if (rc !is XPCOM.NS_OK) error (rc); | 937 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
938 } | 938 } |
939 | 939 |
940 if (proxyHost !is null || port !is -1) { | 940 if (proxyHost !is null || port !is -1) { |
941 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYTYPE, true); | 941 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_PROXYTYPE, true); |
942 rc = prefBranch.SetIntPref (PREFERENCE_PROXYTYPE.ptr, 1); | 942 rc = prefBranch.SetIntPref (PREFERENCE_PROXYTYPE.ptr, 1); |
943 if (rc !is XPCOM.NS_OK) error (rc); | 943 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
944 } | 944 } |
945 | 945 |
946 /* | 946 /* |
947 * Ensure that windows that are shown during page loads are not blocked. Firefox may | 947 * Ensure that windows that are shown during page loads are not blocked. Firefox may |
948 * try to block these by default since such windows are often unwelcome, but this | 948 * try to block these by default since such windows are often unwelcome, but this |
952 */ | 952 */ |
953 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); | 953 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEOPENDURINGLOAD, true); |
954 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEOPENDURINGLOAD.ptr, 0); | 954 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEOPENDURINGLOAD.ptr, 0); |
955 if (rc !is XPCOM.NS_OK) { | 955 if (rc !is XPCOM.NS_OK) { |
956 browser.dispose (); | 956 browser.dispose (); |
957 error (rc); | 957 error (rc, __FILE__, __LINE__); |
958 } | 958 } |
959 | 959 |
960 /* Ensure that the status text can be set through means like javascript */ | 960 /* Ensure that the status text can be set through means like javascript */ |
961 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); | 961 //buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_DISABLEWINDOWSTATUSCHANGE, true); |
962 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEWINDOWSTATUSCHANGE.ptr, 0); | 962 rc = prefBranch.SetBoolPref (PREFERENCE_DISABLEWINDOWSTATUSCHANGE.ptr, 0); |
963 if (rc !is XPCOM.NS_OK) { | 963 if (rc !is XPCOM.NS_OK) { |
964 browser.dispose (); | 964 browser.dispose (); |
965 error (rc); | 965 error (rc, __FILE__, __LINE__); |
966 } | 966 } |
967 | 967 |
968 prefBranch.Release (); | 968 prefBranch.Release (); |
969 | 969 |
970 PromptService2Factory factory = new PromptService2Factory (); | 970 PromptService2Factory factory = new PromptService2Factory (); |
972 | 972 |
973 nsIComponentRegistrar componentRegistrar; | 973 nsIComponentRegistrar componentRegistrar; |
974 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); | 974 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); |
975 if (rc !is XPCOM.NS_OK) { | 975 if (rc !is XPCOM.NS_OK) { |
976 browser.dispose (); | 976 browser.dispose (); |
977 error (rc); | 977 error (rc, __FILE__, __LINE__); |
978 } | 978 } |
979 if (componentRegistrar is null) { | 979 if (componentRegistrar is null) { |
980 browser.dispose (); | 980 browser.dispose (); |
981 error (XPCOM.NS_NOINTERFACE); | 981 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
982 } | 982 } |
983 | 983 |
984 //nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); | 984 //nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); |
985 //result[0] = 0; | 985 //result[0] = 0; |
986 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); | 986 //aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PROMPTSERVICE_CONTRACTID, true); |
989 | 989 |
990 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_PROMPTSERVICE_CID, aClassName.ptr, XPCOM.NS_PROMPTSERVICE_CONTRACTID.ptr, cast(nsIFactory)factory); | 990 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_PROMPTSERVICE_CID, aClassName.ptr, XPCOM.NS_PROMPTSERVICE_CONTRACTID.ptr, cast(nsIFactory)factory); |
991 | 991 |
992 if (rc !is XPCOM.NS_OK) { | 992 if (rc !is XPCOM.NS_OK) { |
993 browser.dispose (); | 993 browser.dispose (); |
994 error (rc); | 994 error (rc, __FILE__, __LINE__); |
995 } | 995 } |
996 factory.Release (); | 996 factory.Release (); |
997 | 997 |
998 HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); | 998 HelperAppLauncherDialogFactory dialogFactory = new HelperAppLauncherDialogFactory (); |
999 dialogFactory.AddRef (); | 999 dialogFactory.AddRef (); |
1001 aClassName = "Helper App Launcher Dialog"; | 1001 aClassName = "Helper App Launcher Dialog"; |
1002 //aClassName = MozillaDelegate.wcsToMbcs (null, "Helper App Launcher Dialog", true); //$NON-NLS-1$ | 1002 //aClassName = MozillaDelegate.wcsToMbcs (null, "Helper App Launcher Dialog", true); //$NON-NLS-1$ |
1003 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName.ptr, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID.ptr, cast(nsIFactory)dialogFactory); | 1003 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CID, aClassName.ptr, XPCOM.NS_HELPERAPPLAUNCHERDIALOG_CONTRACTID.ptr, cast(nsIFactory)dialogFactory); |
1004 if (rc !is XPCOM.NS_OK) { | 1004 if (rc !is XPCOM.NS_OK) { |
1005 browser.dispose (); | 1005 browser.dispose (); |
1006 error (rc); | 1006 error (rc, __FILE__, __LINE__); |
1007 } | 1007 } |
1008 dialogFactory.Release (); | 1008 dialogFactory.Release (); |
1009 | 1009 |
1010 /* | 1010 /* |
1011 * This Download factory will be used if the GRE version is < 1.8. | 1011 * This Download factory will be used if the GRE version is < 1.8. |
1020 aClassName = "Download"; | 1020 aClassName = "Download"; |
1021 //aClassName = MozillaDelegate.wcsToMbcs (null, "Download", true); //$NON-NLS-1$ | 1021 //aClassName = MozillaDelegate.wcsToMbcs (null, "Download", true); //$NON-NLS-1$ |
1022 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_DOWNLOAD_CONTRACTID.ptr, cast(nsIFactory)downloadFactory); | 1022 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_DOWNLOAD_CONTRACTID.ptr, cast(nsIFactory)downloadFactory); |
1023 if (rc !is XPCOM.NS_OK) { | 1023 if (rc !is XPCOM.NS_OK) { |
1024 browser.dispose (); | 1024 browser.dispose (); |
1025 error (rc); | 1025 error (rc, __FILE__, __LINE__); |
1026 } | 1026 } |
1027 downloadFactory.Release (); | 1027 downloadFactory.Release (); |
1028 | 1028 |
1029 FilePickerFactory pickerFactory = IsXULRunner ? new FilePickerFactory_1_8 () : new FilePickerFactory (); | 1029 FilePickerFactory pickerFactory = IsXULRunner ? new FilePickerFactory_1_8 () : new FilePickerFactory (); |
1030 pickerFactory.AddRef (); | 1030 pickerFactory.AddRef (); |
1032 aClassName = "FilePicker"; | 1032 aClassName = "FilePicker"; |
1033 //aClassName = MozillaDelegate.wcsToMbcs (null, "FilePicker", true); //$NON-NLS-1$ | 1033 //aClassName = MozillaDelegate.wcsToMbcs (null, "FilePicker", true); //$NON-NLS-1$ |
1034 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_FILEPICKER_CID, aClassName.ptr, XPCOM.NS_FILEPICKER_CONTRACTID.ptr, cast(nsIFactory)pickerFactory); | 1034 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_FILEPICKER_CID, aClassName.ptr, XPCOM.NS_FILEPICKER_CONTRACTID.ptr, cast(nsIFactory)pickerFactory); |
1035 if (rc !is XPCOM.NS_OK) { | 1035 if (rc !is XPCOM.NS_OK) { |
1036 browser.dispose (); | 1036 browser.dispose (); |
1037 error (rc); | 1037 error (rc, __FILE__, __LINE__); |
1038 } | 1038 } |
1039 pickerFactory.Release (); | 1039 pickerFactory.Release (); |
1040 | 1040 |
1041 componentRegistrar.Release (); | 1041 componentRegistrar.Release (); |
1042 componentManager.Release (); | 1042 componentManager.Release (); |
1051 if (BrowserCount > 0) return; /* another display is still active */ | 1051 if (BrowserCount > 0) return; /* another display is still active */ |
1052 | 1052 |
1053 nsIServiceManager serviceManager; | 1053 nsIServiceManager serviceManager; |
1054 //int /*long*/[] result = new int /*long*/[1]; | 1054 //int /*long*/[] result = new int /*long*/[1]; |
1055 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | 1055 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
1056 if (rc !is XPCOM.NS_OK) error (rc); | 1056 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1057 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); | 1057 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1058 | 1058 |
1059 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 1059 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
1060 //result[0] = 0; | 1060 //result[0] = 0; |
1061 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); | 1061 //byte[] buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_OBSERVER_CONTRACTID, true); |
1062 nsIObserverService observerService; | 1062 nsIObserverService observerService; |
1063 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); | 1063 rc = serviceManager.GetServiceByContractID (XPCOM.NS_OBSERVER_CONTRACTID.ptr, &nsIObserverService.IID, cast(void**)&observerService); |
1064 if (rc !is XPCOM.NS_OK) error (rc); | 1064 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1065 if (observerService is null) error (XPCOM.NS_NOINTERFACE); | 1065 if (observerService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1066 | 1066 |
1067 //nsIObserverService observerService = new nsIObserverService (result[0]); | 1067 //nsIObserverService observerService = new nsIObserverService (result[0]); |
1068 //result[0] = 0; | 1068 //result[0] = 0; |
1069 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_BEFORE_CHANGE, true); | 1069 //buffer = MozillaDelegate.wcsToMbcs (null, PROFILE_BEFORE_CHANGE, true); |
1070 //int length = SHUTDOWN_PERSIST.length (); | 1070 //int length = SHUTDOWN_PERSIST.length (); |
1071 //char[] chars = new char [length + 1]; | 1071 //char[] chars = new char [length + 1]; |
1072 //SHUTDOWN_PERSIST.getChars (0, length, chars, 0); | 1072 //SHUTDOWN_PERSIST.getChars (0, length, chars, 0); |
1073 rc = observerService.NotifyObservers (null, PROFILE_BEFORE_CHANGE.ptr, SHUTDOWN_PERSIST.toString16().toString16z()); | 1073 rc = observerService.NotifyObservers (null, PROFILE_BEFORE_CHANGE.ptr, SHUTDOWN_PERSIST.toString16().toString16z()); |
1074 if (rc !is XPCOM.NS_OK) error (rc); | 1074 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1075 observerService.Release (); | 1075 observerService.Release (); |
1076 | 1076 |
1077 if (LocationProvider !is null) { | 1077 if (LocationProvider !is null) { |
1078 String prefsLocation = LocationProvider.profilePath ~ AppFileLocProvider.PREFERENCES_FILE; | 1078 String prefsLocation = LocationProvider.profilePath ~ AppFileLocProvider.PREFERENCES_FILE; |
1079 scope auto pathString = new nsEmbedString (prefsLocation.toString16()); | 1079 scope auto pathString = new nsEmbedString (prefsLocation.toString16()); |
1080 nsILocalFile localFile; | 1080 nsILocalFile localFile; |
1081 rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); | 1081 rc = XPCOM.NS_NewLocalFile (cast(nsAString*)pathString, 1, &localFile); |
1082 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); | 1082 if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); |
1083 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); | 1083 if (localFile is null) Mozilla.error (XPCOM.NS_ERROR_NULL_POINTER); |
1084 //pathString.dispose (); | 1084 //pathString.dispose (); |
1085 | 1085 |
1086 //nsILocalFile localFile = new nsILocalFile (result [0]); | 1086 //nsILocalFile localFile = new nsILocalFile (result [0]); |
1087 //result[0] = 0; | 1087 //result[0] = 0; |
1088 nsIFile prefFile; | 1088 nsIFile prefFile; |
1089 rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&prefFile); | 1089 rc = localFile.QueryInterface (&nsIFile.IID, cast(void**)&prefFile); |
1090 if (rc !is XPCOM.NS_OK) Mozilla.error (rc); | 1090 if (rc !is XPCOM.NS_OK) Mozilla.error (rc, __FILE__, __LINE__); |
1091 if (prefFile is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); | 1091 if (prefFile is null) Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1092 localFile.Release (); | 1092 localFile.Release (); |
1093 | 1093 |
1094 //nsIFile prefFile = new nsIFile (result[0]); | 1094 //nsIFile prefFile = new nsIFile (result[0]); |
1095 //result[0] = 0; | 1095 //result[0] = 0; |
1096 nsIPrefService prefService; | 1096 nsIPrefService prefService; |
1097 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true); | 1097 //buffer = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_PREFSERVICE_CONTRACTID, true); |
1098 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); | 1098 rc = serviceManager.GetServiceByContractID (XPCOM.NS_PREFSERVICE_CONTRACTID.ptr, &nsIPrefService.IID, cast(void**)&prefService); |
1099 if (rc !is XPCOM.NS_OK) error (rc); | 1099 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1100 if (prefService is null) error (XPCOM.NS_NOINTERFACE); | 1100 if (prefService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1101 | 1101 |
1102 //nsIPrefService prefService = new nsIPrefService (result[0]); | 1102 //nsIPrefService prefService = new nsIPrefService (result[0]); |
1103 //result[0] = 0; | 1103 //result[0] = 0; |
1104 rc = prefService.SavePrefFile(prefFile); | 1104 rc = prefService.SavePrefFile(prefFile); |
1105 prefService.Release (); | 1105 prefService.Release (); |
1124 BrowserCount++; | 1124 BrowserCount++; |
1125 nsIComponentManager componentManager; | 1125 nsIComponentManager componentManager; |
1126 int rc = XPCOM.NS_GetComponentManager (&componentManager); | 1126 int rc = XPCOM.NS_GetComponentManager (&componentManager); |
1127 if (rc !is XPCOM.NS_OK) { | 1127 if (rc !is XPCOM.NS_OK) { |
1128 browser.dispose (); | 1128 browser.dispose (); |
1129 error (rc); | 1129 error (rc, __FILE__, __LINE__); |
1130 } | 1130 } |
1131 if (componentManager is null) { | 1131 if (componentManager is null) { |
1132 browser.dispose (); | 1132 browser.dispose (); |
1133 error (XPCOM.NS_NOINTERFACE); | 1133 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1134 } | 1134 } |
1135 | 1135 |
1136 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); | 1136 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
1137 //result[0] = 0; | 1137 //result[0] = 0; |
1138 nsIWebBrowser webBrowser; | 1138 //nsIWebBrowser webBrowser; |
1139 nsID NS_IWEBBROWSER_CID = { 0xF1EAC761, 0x87E9, 0x11d3, [0xAF, 0x80, 0x00, 0xA0, 0x24, 0xFF, 0xC0, 0x8C] }; //$NON-NLS-1$ | 1139 nsID NS_IWEBBROWSER_CID = { 0xF1EAC761, 0x87E9, 0x11d3, [0xAF, 0x80, 0x00, 0xA0, 0x24, 0xFF, 0xC0, 0x8C] }; //$NON-NLS-1$ |
1140 rc = componentManager.CreateInstance (&NS_IWEBBROWSER_CID, null, &nsIWebBrowser.IID, cast(void**)&webBrowser); | 1140 rc = componentManager.CreateInstance (&NS_IWEBBROWSER_CID, null, &nsIWebBrowser.IID, cast(void**)&webBrowser); |
1141 if (rc !is XPCOM.NS_OK) { | 1141 if (rc !is XPCOM.NS_OK) { |
1142 browser.dispose (); | 1142 browser.dispose (); |
1143 error (rc); | 1143 error (rc, __FILE__, __LINE__); |
1144 } | 1144 } |
1145 if (webBrowser is null) { | 1145 if (webBrowser is null) { |
1146 browser.dispose (); | 1146 browser.dispose (); |
1147 error (XPCOM.NS_NOINTERFACE); | 1147 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1148 } | 1148 } |
1149 | 1149 |
1150 //webBrowser = new nsIWebBrowser (result[0]); | |
1151 //result[0] = 0; | |
1152 | |
1153 //createCOMInterfaces (); | |
1154 this.AddRef (); | 1150 this.AddRef (); |
1155 | 1151 |
1156 /***** CAREFUL HERE: check to make sure this is correct XPCOM | 1152 rc = webBrowser.SetContainerWindow ( cast(nsIWebBrowserChrome)this ); |
1157 ***** connection for webBrowserChrome. -JJR | |
1158 *****/ | |
1159 nsIWebBrowserChrome webBrowserChrome; //represents the this Mozilla internal interface | |
1160 | |
1161 rc = this.QueryInterface(&nsIWebBrowserChrome.IID, cast(void**)&webBrowserChrome ); | |
1162 if (rc !is XPCOM.NS_OK) | |
1163 Mozilla.error (rc); | |
1164 if (webBrowserChrome is null) | |
1165 Mozilla.error (XPCOM.NS_ERROR_NO_INTERFACE); | |
1166 | |
1167 rc = webBrowser.SetContainerWindow ( webBrowserChrome ); // set chrome to self | |
1168 if (rc !is XPCOM.NS_OK) { | 1153 if (rc !is XPCOM.NS_OK) { |
1169 browser.dispose (); | 1154 browser.dispose (); |
1170 error (rc); | 1155 error (rc, __FILE__, __LINE__); |
1171 } | 1156 } |
1172 | 1157 |
1173 nsIBaseWindow baseWindow; | 1158 nsIBaseWindow baseWindow; |
1174 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | 1159 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
1175 if (rc !is XPCOM.NS_OK) { | 1160 if (rc !is XPCOM.NS_OK) { |
1176 browser.dispose (); | 1161 browser.dispose (); |
1177 error (rc); | 1162 error (rc, __FILE__, __LINE__); |
1178 } | 1163 } |
1179 if (baseWindow is null) { | 1164 if (baseWindow is null) { |
1180 browser.dispose (); | 1165 browser.dispose (); |
1181 error (XPCOM.NS_ERROR_NO_INTERFACE); | 1166 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1182 } | 1167 } |
1183 | 1168 |
1184 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); | 1169 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
1185 //result[0] = 0; | 1170 //result[0] = 0; |
1186 Rectangle rect = browser.getClientArea (); | 1171 Rectangle rect = browser.getClientArea (); |
1221 browser.dispose (); | 1206 browser.dispose (); |
1222 error (XPCOM.NS_ERROR_FAILURE); | 1207 error (XPCOM.NS_ERROR_FAILURE); |
1223 } | 1208 } |
1224 if (interfaceRequestor is null) { | 1209 if (interfaceRequestor is null) { |
1225 browser.dispose (); | 1210 browser.dispose (); |
1226 error (XPCOM.NS_ERROR_NO_INTERFACE); | 1211 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1227 } | 1212 } |
1228 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); | 1213 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); |
1229 //result[0] = 0; | 1214 //result[0] = 0; |
1230 | 1215 |
1231 nsIDocShell docShell; | 1216 nsIDocShell docShell; |
1253 //result[0] = 0; | 1238 //result[0] = 0; |
1254 nsIComponentRegistrar componentRegistrar; | 1239 nsIComponentRegistrar componentRegistrar; |
1255 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); | 1240 rc = componentManager.QueryInterface (&nsIComponentRegistrar.IID, cast(void**)&componentRegistrar); |
1256 if (rc !is XPCOM.NS_OK) { | 1241 if (rc !is XPCOM.NS_OK) { |
1257 browser.dispose (); | 1242 browser.dispose (); |
1258 error (rc); | 1243 error (rc, __FILE__, __LINE__); |
1259 } | 1244 } |
1260 if (componentRegistrar is null) { | 1245 if (componentRegistrar is null) { |
1261 browser.dispose (); | 1246 browser.dispose (); |
1262 error (XPCOM.NS_NOINTERFACE); | 1247 error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1263 } | 1248 } |
1264 | 1249 |
1265 // nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); | 1250 // nsIComponentRegistrar componentRegistrar = new nsIComponentRegistrar (result[0]); |
1266 DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); | 1251 DownloadFactory_1_8 downloadFactory_1_8 = new DownloadFactory_1_8 (); |
1267 downloadFactory_1_8.AddRef (); | 1252 downloadFactory_1_8.AddRef (); |
1269 | 1254 |
1270 String aClassName = "Transfer"; //$NON-NLS-1$ | 1255 String aClassName = "Transfer"; //$NON-NLS-1$ |
1271 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_TRANSFER_CONTRACTID.ptr, cast(nsIFactory)downloadFactory_1_8); | 1256 rc = componentRegistrar.RegisterFactory (&XPCOM.NS_DOWNLOAD_CID, aClassName.ptr, XPCOM.NS_TRANSFER_CONTRACTID.ptr, cast(nsIFactory)downloadFactory_1_8); |
1272 if (rc !is XPCOM.NS_OK) { | 1257 if (rc !is XPCOM.NS_OK) { |
1273 browser.dispose (); | 1258 browser.dispose (); |
1274 error (rc); | 1259 error (rc, __FILE__, __LINE__); |
1275 } | 1260 } |
1276 downloadFactory_1_8.Release (); | 1261 downloadFactory_1_8.Release (); |
1277 componentRegistrar.Release (); | 1262 componentRegistrar.Release (); |
1278 } else { /* >= 1.9 */ | 1263 } else { /* >= 1.9 */ |
1279 /* | 1264 /* |
1287 awaitingNavigate = true; | 1272 awaitingNavigate = true; |
1288 nsIWebNavigation webNavigation; | 1273 nsIWebNavigation webNavigation; |
1289 rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1274 rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1290 if (rc !is XPCOM.NS_OK) { | 1275 if (rc !is XPCOM.NS_OK) { |
1291 browser.dispose (); | 1276 browser.dispose (); |
1292 error (rc); | 1277 error (rc, __FILE__, __LINE__); |
1293 } | 1278 } |
1294 if (webNavigation is null) { | 1279 if (webNavigation is null) { |
1295 browser.dispose (); | 1280 browser.dispose (); |
1296 error (XPCOM.NS_ERROR_NO_INTERFACE); | 1281 error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1297 } | 1282 } |
1298 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1283 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1299 //char[] uri = new char[ABOUT_BLANK.length () + 1]; | 1284 //char[] uri = new char[ABOUT_BLANK.length () + 1]; |
1300 //ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0); | 1285 //ABOUT_BLANK.getChars (0, ABOUT_BLANK.length (), uri, 0); |
1301 rc = webNavigation.LoadURI (ABOUT_BLANK.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); | 1286 rc = webNavigation.LoadURI (ABOUT_BLANK.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); |
1304 } | 1289 } |
1305 //result[0] = 0; | 1290 //result[0] = 0; |
1306 interfaceRequestor.Release (); | 1291 interfaceRequestor.Release (); |
1307 } | 1292 } |
1308 componentManager.Release (); | 1293 componentManager.Release (); |
1309 /* | 1294 |
1310 // REMOVE: not necessary | |
1311 nsIWeakReference weakReference; | |
1312 | |
1313 rc = this.QueryInterface(&nsIWeakReference.IID, cast(void**)&weakReference); | |
1314 if (rc !is XPCOM.NS_OK) { | |
1315 browser.dispose(); | |
1316 error(rc); | |
1317 } | |
1318 if (weakReference is null) { | |
1319 browser.dispose(); | |
1320 error(XPCOM.NS_ERROR_NO_INTERFACE); | |
1321 } | |
1322 */ | |
1323 rc = webBrowser.AddWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); | 1295 rc = webBrowser.AddWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); |
1324 if (rc !is XPCOM.NS_OK) { | 1296 if (rc !is XPCOM.NS_OK) { |
1325 browser.dispose (); | 1297 browser.dispose (); |
1326 error (rc); | 1298 error (rc, __FILE__, __LINE__); |
1327 } | 1299 } |
1328 | 1300 |
1329 // TODO: Find appropriate place to "Release" uriContentListener -JJR | 1301 // TODO: Find appropriate place to "Release" uriContentListener -JJR |
1330 nsIURIContentListener uriContentListener; | 1302 nsIURIContentListener uriContentListener; |
1331 this.QueryInterface(&nsIURIContentListener.IID, cast(void**)&uriContentListener); | 1303 this.QueryInterface(&nsIURIContentListener.IID, cast(void**)&uriContentListener); |
1339 } | 1311 } |
1340 | 1312 |
1341 rc = webBrowser.SetParentURIContentListener (uriContentListener); | 1313 rc = webBrowser.SetParentURIContentListener (uriContentListener); |
1342 if (rc !is XPCOM.NS_OK) { | 1314 if (rc !is XPCOM.NS_OK) { |
1343 browser.dispose (); | 1315 browser.dispose (); |
1344 error (rc); | 1316 error (rc, __FILE__, __LINE__); |
1345 } | 1317 } |
1346 | 1318 |
1347 mozDelegate.init (); | 1319 mozDelegate.init (); |
1348 | 1320 |
1349 listener = new class () Listener { | 1321 listener = new class () Listener { |
1409 if (awaitingNavigate) return false; | 1381 if (awaitingNavigate) return false; |
1410 | 1382 |
1411 //int /*long*/[] result = new int /*long*/[1]; | 1383 //int /*long*/[] result = new int /*long*/[1]; |
1412 nsIWebNavigation webNavigation; | 1384 nsIWebNavigation webNavigation; |
1413 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1385 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1414 if (rc !is XPCOM.NS_OK) error (rc); | 1386 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1415 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1387 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1416 | 1388 |
1417 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1389 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1418 rc = webNavigation.GoBack (); | 1390 rc = webNavigation.GoBack (); |
1419 webNavigation.Release (); | 1391 webNavigation.Release (); |
1420 return rc is XPCOM.NS_OK; | 1392 return rc is XPCOM.NS_OK; |
1426 | 1398 |
1427 String url = PREFIX_JAVASCRIPT ~ script ~ ";void(0);"; //$NON-NLS-1$ | 1399 String url = PREFIX_JAVASCRIPT ~ script ~ ";void(0);"; //$NON-NLS-1$ |
1428 //int /*long*/[] result = new int /*long*/[1]; | 1400 //int /*long*/[] result = new int /*long*/[1]; |
1429 nsIWebNavigation webNavigation; | 1401 nsIWebNavigation webNavigation; |
1430 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1402 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1431 if (rc !is XPCOM.NS_OK) error (rc); | 1403 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1432 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1404 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1433 | 1405 |
1434 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1406 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1435 //char[] arg = url.toCharArray (); | 1407 //char[] arg = url.toCharArray (); |
1436 //char[] c = new char[arg.length+1]; | 1408 //char[] c = new char[arg.length+1]; |
1437 //System.arraycopy (arg, 0, c, 0, arg.length); | 1409 //System.arraycopy (arg, 0, c, 0, arg.length); |
1450 if (awaitingNavigate) return false; | 1422 if (awaitingNavigate) return false; |
1451 | 1423 |
1452 //int /*long*/[] result = new int /*long*/[1]; | 1424 //int /*long*/[] result = new int /*long*/[1]; |
1453 nsIWebNavigation webNavigation; | 1425 nsIWebNavigation webNavigation; |
1454 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1426 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1455 if (rc !is XPCOM.NS_OK) error (rc); | 1427 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1456 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1428 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1457 | 1429 |
1458 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1430 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1459 rc = webNavigation.GoForward (); | 1431 rc = webNavigation.GoForward (); |
1460 webNavigation.Release (); | 1432 webNavigation.Release (); |
1461 | 1433 |
1467 if (awaitingNavigate) return ""; //$NON-NLS-1$ | 1439 if (awaitingNavigate) return ""; //$NON-NLS-1$ |
1468 | 1440 |
1469 //int /*long*/[] result = new int /*long*/[1]; | 1441 //int /*long*/[] result = new int /*long*/[1]; |
1470 nsIDOMWindow window; | 1442 nsIDOMWindow window; |
1471 int rc = webBrowser.GetContentDOMWindow (&window); | 1443 int rc = webBrowser.GetContentDOMWindow (&window); |
1472 if (rc !is XPCOM.NS_OK) error (rc); | 1444 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1473 if (window is null) error (XPCOM.NS_NOINTERFACE); | 1445 if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1474 | 1446 |
1475 //nsIDOMWindow window = new nsIDOMWindow (result[0]); | 1447 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
1476 //result[0] = 0; | 1448 //result[0] = 0; |
1477 nsIDOMDocument document; | 1449 nsIDOMDocument document; |
1478 rc = window.GetDocument (&document); | 1450 rc = window.GetDocument (&document); |
1479 if (rc !is XPCOM.NS_OK) error (rc); | 1451 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1480 if (document is null) error (XPCOM.NS_NOINTERFACE); | 1452 if (document is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1481 window.Release (); | 1453 window.Release (); |
1482 | 1454 |
1483 //int /*long*/ document = result[0]; | 1455 //int /*long*/ document = result[0]; |
1484 //result[0] = 0; | 1456 //result[0] = 0; |
1485 nsIComponentManager componentManager; | 1457 nsIComponentManager componentManager; |
1486 rc = XPCOM.NS_GetComponentManager (&componentManager); | 1458 rc = XPCOM.NS_GetComponentManager (&componentManager); |
1487 if (rc !is XPCOM.NS_OK) error (rc); | 1459 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1488 if (componentManager is null) error (XPCOM.NS_NOINTERFACE); | 1460 if (componentManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1489 | 1461 |
1490 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); | 1462 //nsIComponentManager componentManager = new nsIComponentManager (result[0]); |
1491 //result[0] = 0; | 1463 //result[0] = 0; |
1492 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); | 1464 //byte[] contractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_DOMSERIALIZER_CONTRACTID, true); |
1493 String chars = null; | 1465 String chars = null; |
1494 nsIDOMSerializer_1_7 serializer_1_7; | 1466 nsIDOMSerializer_1_7 serializer_1_7; |
1495 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer_1_7.IID, cast(void**)&serializer_1_7); | 1467 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer_1_7.IID, cast(void**)&serializer_1_7); |
1496 if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ | 1468 if (rc is XPCOM.NS_OK) { /* mozilla >= 1.7 */ |
1497 if (serializer_1_7 is null) error (XPCOM.NS_NOINTERFACE); | 1469 if (serializer_1_7 is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1498 | 1470 |
1499 //nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); | 1471 //nsIDOMSerializer_1_7 serializer = new nsIDOMSerializer_1_7 (result[0]); |
1500 //result[0] = 0; | 1472 //result[0] = 0; |
1501 scope auto string = new nsEmbedString; | 1473 scope auto string = new nsEmbedString; |
1502 rc = serializer_1_7.SerializeToString (cast(nsIDOMNode)document, cast(nsAString*) string); | 1474 rc = serializer_1_7.SerializeToString (cast(nsIDOMNode)document, cast(nsAString*) string); |
1509 //XPCOM.nsEmbedString_delete (string); | 1481 //XPCOM.nsEmbedString_delete (string); |
1510 chars = string.toString(); | 1482 chars = string.toString(); |
1511 } else { /* mozilla < 1.7 */ | 1483 } else { /* mozilla < 1.7 */ |
1512 nsIDOMSerializer serializer; | 1484 nsIDOMSerializer serializer; |
1513 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer.IID, cast(void**)&serializer); | 1485 rc = componentManager.CreateInstanceByContractID (XPCOM.NS_DOMSERIALIZER_CONTRACTID.ptr, null, &nsIDOMSerializer.IID, cast(void**)&serializer); |
1514 if (rc !is XPCOM.NS_OK) error (rc); | 1486 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1515 if (serializer is null) error (XPCOM.NS_NOINTERFACE); | 1487 if (serializer is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1516 // TODO: Lookup SerializeToString contract. Find out if the string must provide it's own memory to the method. -JJR | 1488 // TODO: Lookup SerializeToString contract. Find out if the string must provide it's own memory to the method. -JJR |
1517 PRUnichar* string; | 1489 PRUnichar* string; |
1518 //nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); | 1490 //nsIDOMSerializer serializer = new nsIDOMSerializer (result[0]); |
1519 //result[0] = 0; | 1491 //result[0] = 0; |
1520 rc = serializer.SerializeToString (cast(nsIDOMNode)document, &string ); | 1492 rc = serializer.SerializeToString (cast(nsIDOMNode)document, &string ); |
1536 if (awaitingNavigate) return ""; //$NON-NLS-1$ | 1508 if (awaitingNavigate) return ""; //$NON-NLS-1$ |
1537 | 1509 |
1538 //int /*long*/[] result = new int /*long*/[1]; | 1510 //int /*long*/[] result = new int /*long*/[1]; |
1539 nsIWebNavigation webNavigation; | 1511 nsIWebNavigation webNavigation; |
1540 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1512 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1541 if (rc !is XPCOM.NS_OK) error (rc); | 1513 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1542 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1514 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1543 | 1515 |
1544 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1516 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1545 nsIURI aCurrentURI; | 1517 nsIURI aCurrentURI; |
1546 rc = webNavigation.GetCurrentURI (&aCurrentURI); | 1518 rc = webNavigation.GetCurrentURI (&aCurrentURI); |
1547 if (rc !is XPCOM.NS_OK) error (rc); | 1519 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1548 webNavigation.Release (); | 1520 webNavigation.Release (); |
1549 | 1521 |
1550 String location = null; | 1522 String location = null; |
1551 if (aCurrentURI !is null) { | 1523 if (aCurrentURI !is null) { |
1552 //nsIURI uri = new nsIURI (aCurrentURI[0]); | 1524 //nsIURI uri = new nsIURI (aCurrentURI[0]); |
1553 scope auto aSpec = new nsEmbedCString; | 1525 scope auto aSpec = new nsEmbedCString; |
1554 rc = aCurrentURI.GetSpec (cast(nsACString*)aSpec); | 1526 rc = aCurrentURI.GetSpec (cast(nsACString*)aSpec); |
1555 if (rc !is XPCOM.NS_OK) error (rc); | 1527 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1556 //int length = XPCOM.nsEmbedCString_Length (aSpec); | 1528 //int length = XPCOM.nsEmbedCString_Length (aSpec); |
1557 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); | 1529 //int /*long*/ buffer = XPCOM.nsEmbedCString_get (aSpec); |
1558 location = aSpec.toString; | 1530 location = aSpec.toString; |
1559 //XPCOM.memmove (dest, buffer, length); | 1531 //XPCOM.memmove (dest, buffer, length); |
1560 //XPCOM.nsEmbedCString_delete (aSpec); | 1532 //XPCOM.nsEmbedCString_delete (aSpec); |
1605 if (awaitingNavigate) return false; | 1577 if (awaitingNavigate) return false; |
1606 | 1578 |
1607 //int /*long*/[] result = new int /*long*/[1]; | 1579 //int /*long*/[] result = new int /*long*/[1]; |
1608 nsIWebNavigation webNavigation; | 1580 nsIWebNavigation webNavigation; |
1609 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1581 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1610 if (rc !is XPCOM.NS_OK) error (rc); | 1582 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1611 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1583 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1612 | 1584 |
1613 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1585 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1614 PRBool aCanGoBack; /* PRBool */ | 1586 PRBool aCanGoBack; /* PRBool */ |
1615 rc = webNavigation.GetCanGoBack (&aCanGoBack); | 1587 rc = webNavigation.GetCanGoBack (&aCanGoBack); |
1616 webNavigation.Release (); | 1588 webNavigation.Release (); |
1622 if (awaitingNavigate) return false; | 1594 if (awaitingNavigate) return false; |
1623 | 1595 |
1624 //int /*long*/[] result = new int /*long*/[1]; | 1596 //int /*long*/[] result = new int /*long*/[1]; |
1625 nsIWebNavigation webNavigation; | 1597 nsIWebNavigation webNavigation; |
1626 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1598 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1627 if (rc !is XPCOM.NS_OK) error (rc); | 1599 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1628 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1600 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1629 | 1601 |
1630 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1602 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1631 PRBool aCanGoForward; /* PRBool */ | 1603 PRBool aCanGoForward; /* PRBool */ |
1632 rc = webNavigation.GetCanGoForward (&aCanGoForward); | 1604 rc = webNavigation.GetCanGoForward (&aCanGoForward); |
1633 webNavigation.Release (); | 1605 webNavigation.Release (); |
1634 return aCanGoForward !is 0; | 1606 return aCanGoForward !is 0; |
1635 } | 1607 } |
1636 | 1608 |
1637 extern(D) | 1609 extern(D) |
1638 static String error (int code) { | 1610 static void error (int code ) { |
1611 error ( code, "NOT GIVEN", 0 ); | |
1612 } | |
1613 | |
1614 extern(D) | |
1615 static String error (int code, char[] file, int line) { | |
1616 Stdout ("File: ")(file)(" Line: ")(line).newline; | |
1639 throw new DWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$ | 1617 throw new DWTError ("XPCOM error " ~ Integer.toString(code)); //$NON-NLS-1$ |
1640 } | 1618 } |
1641 | 1619 |
1642 extern(D) | 1620 extern(D) |
1643 void onDispose (Display display) { | 1621 void onDispose (Display display) { |
1644 int rc = webBrowser.RemoveWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); | 1622 int rc = webBrowser.RemoveWebBrowserListener (cast(nsIWeakReference)this, &nsIWebProgressListener.IID); |
1645 if (rc !is XPCOM.NS_OK) error (rc); | 1623 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1646 | 1624 |
1647 rc = webBrowser.SetParentURIContentListener (null); | 1625 rc = webBrowser.SetParentURIContentListener (null); |
1648 if (rc !is XPCOM.NS_OK) error (rc); | 1626 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1649 | 1627 |
1650 unhookDOMListeners (); | 1628 unhookDOMListeners (); |
1651 if (listener !is null) { | 1629 if (listener !is null) { |
1652 int[] folderEvents = [ | 1630 int[] folderEvents = [ |
1653 DWT.Dispose, | 1631 DWT.Dispose, |
1665 } | 1643 } |
1666 | 1644 |
1667 //int /*long*/[] result = new int /*long*/[1]; | 1645 //int /*long*/[] result = new int /*long*/[1]; |
1668 nsIBaseWindow baseWindow; | 1646 nsIBaseWindow baseWindow; |
1669 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | 1647 rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
1670 if (rc !is XPCOM.NS_OK) error (rc); | 1648 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1671 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1649 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1672 | 1650 |
1673 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); | 1651 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
1674 rc = baseWindow.Destroy (); | 1652 rc = baseWindow.Destroy (); |
1675 if (rc !is XPCOM.NS_OK) error (rc); | 1653 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1676 baseWindow.Release (); | 1654 baseWindow.Release (); |
1677 | 1655 |
1678 Release (); | 1656 Release (); |
1679 webBrowser.Release (); | 1657 webBrowser.Release (); |
1680 webBrowser = null; | 1658 webBrowser = null; |
1701 extern(D) | 1679 extern(D) |
1702 void Activate () { | 1680 void Activate () { |
1703 //int /*long*/[] result = new int /*long*/[1]; | 1681 //int /*long*/[] result = new int /*long*/[1]; |
1704 nsIWebBrowserFocus webBrowserFocus; | 1682 nsIWebBrowserFocus webBrowserFocus; |
1705 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | 1683 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); |
1706 if (rc !is XPCOM.NS_OK) error (rc); | 1684 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1707 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1685 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1708 | 1686 |
1709 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); | 1687 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); |
1710 rc = webBrowserFocus.Activate (); | 1688 rc = webBrowserFocus.Activate (); |
1711 if (rc !is XPCOM.NS_OK) error (rc); | 1689 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1712 webBrowserFocus.Release (); | 1690 webBrowserFocus.Release (); |
1713 } | 1691 } |
1714 | 1692 |
1715 extern(D) | 1693 extern(D) |
1716 void Deactivate () { | 1694 void Deactivate () { |
1717 //int /*long*/[] result = new int /*long*/[1]; | 1695 //int /*long*/[] result = new int /*long*/[1]; |
1718 nsIWebBrowserFocus webBrowserFocus; | 1696 nsIWebBrowserFocus webBrowserFocus; |
1719 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); | 1697 int rc = webBrowser.QueryInterface (&nsIWebBrowserFocus.IID, cast(void**)&webBrowserFocus); |
1720 if (rc !is XPCOM.NS_OK) error (rc); | 1698 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1721 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1699 if (webBrowserFocus is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1722 | 1700 |
1723 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); | 1701 //nsIWebBrowserFocus webBrowserFocus = new nsIWebBrowserFocus (result[0]); |
1724 rc = webBrowserFocus.Deactivate (); | 1702 rc = webBrowserFocus.Deactivate (); |
1725 if (rc !is XPCOM.NS_OK) error (rc); | 1703 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1726 webBrowserFocus.Release (); | 1704 webBrowserFocus.Release (); |
1727 } | 1705 } |
1728 | 1706 |
1729 extern(D) | 1707 extern(D) |
1730 void onResize () { | 1708 void onResize () { |
1733 int height = Math.max (1, rect.height); | 1711 int height = Math.max (1, rect.height); |
1734 | 1712 |
1735 //int /*long*/[] result = new int /*long*/[1]; | 1713 //int /*long*/[] result = new int /*long*/[1]; |
1736 nsIBaseWindow baseWindow; | 1714 nsIBaseWindow baseWindow; |
1737 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | 1715 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
1738 if (rc !is XPCOM.NS_OK) error (rc); | 1716 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1739 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1717 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1740 | 1718 |
1741 mozDelegate.setSize (embedHandle, width, height); | 1719 mozDelegate.setSize (embedHandle, width, height); |
1742 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); | 1720 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
1743 rc = baseWindow.SetPositionAndSize (0, 0, width, height, 1); | 1721 rc = baseWindow.SetPositionAndSize (0, 0, width, height, 1); |
1744 if (rc !is XPCOM.NS_OK) error (rc); | 1722 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1745 baseWindow.Release (); | 1723 baseWindow.Release (); |
1746 } | 1724 } |
1747 | 1725 |
1748 extern(D) | 1726 extern(D) |
1749 public void refresh () { | 1727 public void refresh () { |
1751 | 1729 |
1752 //int /*long*/[] result = new int /*long*/[1]; | 1730 //int /*long*/[] result = new int /*long*/[1]; |
1753 nsIWebNavigation webNavigation; | 1731 nsIWebNavigation webNavigation; |
1754 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1732 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1755 if (rc !is XPCOM.NS_OK) error(rc); | 1733 if (rc !is XPCOM.NS_OK) error(rc); |
1756 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1734 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1757 | 1735 |
1758 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1736 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1759 rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE); | 1737 rc = webNavigation.Reload (nsIWebNavigation.LOAD_FLAGS_NONE); |
1760 webNavigation.Release (); | 1738 webNavigation.Release (); |
1761 if (rc is XPCOM.NS_OK) return; | 1739 if (rc is XPCOM.NS_OK) return; |
1767 * Feature in Mozilla. Attempting to reload a file that no longer exists | 1745 * Feature in Mozilla. Attempting to reload a file that no longer exists |
1768 * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to | 1746 * returns an error code of NS_ERROR_FILE_NOT_FOUND. This is equivalent to |
1769 * attempting to load a non-existent local url, which is not a Browser error, | 1747 * attempting to load a non-existent local url, which is not a Browser error, |
1770 * so this error code should be ignored. | 1748 * so this error code should be ignored. |
1771 */ | 1749 */ |
1772 if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc); | 1750 if (rc !is XPCOM.NS_ERROR_INVALID_POINTER && rc !is XPCOM.NS_ERROR_FILE_NOT_FOUND) error (rc, __FILE__, __LINE__); |
1773 } | 1751 } |
1774 | 1752 |
1775 extern(D) | 1753 extern(D) |
1776 public bool setText (String html) { | 1754 public bool setText (String html) { |
1777 /* | 1755 /* |
1789 * The current workaround is to call deactivate everytime if | 1767 * The current workaround is to call deactivate everytime if |
1790 * the browser currently does not have focus. A better workaround | 1768 * the browser currently does not have focus. A better workaround |
1791 * would be to have a way to call deactivate when the Browser | 1769 * would be to have a way to call deactivate when the Browser |
1792 * or one of its children loses focus. | 1770 * or one of its children loses focus. |
1793 */ | 1771 */ |
1794 if (browser !is browser.getDisplay ().getFocusControl ()) Deactivate (); | 1772 if (browser !is browser.getDisplay().getFocusControl ()) { |
1795 | 1773 Deactivate (); |
1774 } | |
1796 /* convert the String containing HTML to an array of bytes with UTF-8 data */ | 1775 /* convert the String containing HTML to an array of bytes with UTF-8 data */ |
1797 /+ | 1776 /+ |
1798 byte[] data = null; | 1777 byte[] data = null; |
1799 try { | 1778 try { |
1800 data = html.getBytes ("UTF-8"); //$NON-NLS-1$ | 1779 data = html.getBytes ("UTF-8"); //$NON-NLS-1$ |
1810 scope auto aContentCharset = new nsEmbedCString ("UTF-8"); | 1789 scope auto aContentCharset = new nsEmbedCString ("UTF-8"); |
1811 | 1790 |
1812 //int /*long*/[] result = new int /*long*/[1]; | 1791 //int /*long*/[] result = new int /*long*/[1]; |
1813 nsIServiceManager serviceManager; | 1792 nsIServiceManager serviceManager; |
1814 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | 1793 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
1815 if (rc !is XPCOM.NS_OK) error (rc); | 1794 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1816 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); | 1795 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1817 | 1796 |
1818 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 1797 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
1819 //result[0] = 0; | 1798 //result[0] = 0; |
1820 nsIIOService ioService; | 1799 nsIIOService ioService; |
1821 rc = serviceManager.GetService (&XPCOM.NS_IOSERVICE_CID, &nsIIOService.IID, cast(void**)&ioService); | 1800 rc = serviceManager.GetService (&XPCOM.NS_IOSERVICE_CID, &nsIIOService.IID, cast(void**)&ioService); |
1822 if (rc !is XPCOM.NS_OK) error (rc); | 1801 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1823 if (ioService is null) error (XPCOM.NS_NOINTERFACE); | 1802 if (ioService is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1824 serviceManager.Release (); | 1803 serviceManager.Release (); |
1825 | 1804 |
1826 //nsIIOService ioService = new nsIIOService (result[0]); | 1805 //nsIIOService ioService = new nsIIOService (result[0]); |
1827 //result[0] = 0; | 1806 //result[0] = 0; |
1828 /* | 1807 /* |
1832 */ | 1811 */ |
1833 //byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false); | 1812 //byte[] aString = MozillaDelegate.wcsToMbcs (null, URI_FROMMEMORY, false); |
1834 scope auto aSpec = new nsEmbedCString(URI_FROMMEMORY); | 1813 scope auto aSpec = new nsEmbedCString(URI_FROMMEMORY); |
1835 nsIURI uri; | 1814 nsIURI uri; |
1836 rc = ioService.NewURI (cast(nsACString*)aSpec, null, null, &uri); | 1815 rc = ioService.NewURI (cast(nsACString*)aSpec, null, null, &uri); |
1837 if (rc !is XPCOM.NS_OK) error (rc); | 1816 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1838 if (uri is null) error (XPCOM.NS_NOINTERFACE); | 1817 if (uri is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
1839 //XPCOM.nsEmbedCString_delete (aSpec); | 1818 //XPCOM.nsEmbedCString_delete (aSpec); |
1840 ioService.Release (); | 1819 ioService.Release (); |
1841 | 1820 |
1842 //nsIURI uri = new nsIURI (result[0]); | 1821 //nsIURI uri = new nsIURI (result[0]); |
1843 //result[0] = 0; | 1822 //result[0] = 0; |
1844 nsIInterfaceRequestor interfaceRequestor; | 1823 nsIInterfaceRequestor interfaceRequestor; |
1845 rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); | 1824 rc = webBrowser.QueryInterface (&nsIInterfaceRequestor.IID, cast(void**)&interfaceRequestor); |
1846 if (rc !is XPCOM.NS_OK) error (rc); | 1825 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1847 if (interfaceRequestor is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1826 if (interfaceRequestor is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1848 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); | 1827 //nsIInterfaceRequestor interfaceRequestor = new nsIInterfaceRequestor (result[0]); |
1849 //result[0] = 0; | 1828 //result[0] = 0; |
1850 | 1829 |
1851 /* | 1830 /* |
1852 * Feature in Mozilla. LoadStream invokes the nsIInputStream argument | 1831 * Feature in Mozilla. LoadStream invokes the nsIInputStream argument |
1860 inputStream.AddRef (); | 1839 inputStream.AddRef (); |
1861 | 1840 |
1862 nsIDocShell_1_9 docShell_1_9; | 1841 nsIDocShell_1_9 docShell_1_9; |
1863 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_9.IID, cast(void**)&docShell_1_9); | 1842 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_9.IID, cast(void**)&docShell_1_9); |
1864 if (rc is XPCOM.NS_OK) { | 1843 if (rc is XPCOM.NS_OK) { |
1865 if (docShell_1_9 is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1844 if (docShell_1_9 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1866 //nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); | 1845 //nsIDocShell_1_9 docShell = new nsIDocShell_1_9 (result[0]); |
1867 rc = docShell_1_9.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | 1846 rc = docShell_1_9.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); |
1868 docShell_1_9.Release (); | 1847 docShell_1_9.Release (); |
1869 } else { | 1848 } else { |
1870 //result[0] = 0; | 1849 //result[0] = 0; |
1871 nsIDocShell_1_8 docShell_1_8; | 1850 nsIDocShell_1_8 docShell_1_8; |
1872 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); | 1851 rc = interfaceRequestor.GetInterface (&nsIDocShell_1_8.IID, cast(void**)&docShell_1_8); |
1873 if (rc is XPCOM.NS_OK) { | 1852 if (rc is XPCOM.NS_OK) { |
1874 if (docShell_1_8 is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1853 if (docShell_1_8 is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1875 //nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); | 1854 //nsIDocShell_1_8 docShell = new nsIDocShell_1_8 (result[0]); |
1876 rc = docShell_1_8.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); | 1855 rc = docShell_1_8.LoadStream (inputStream, uri, cast(nsACString*)aContentType, cast(nsACString*)aContentCharset, null); |
1877 docShell_1_8.Release (); | 1856 docShell_1_8.Release (); |
1878 } else { | 1857 } else { |
1879 //result[0] = 0; | 1858 //result[0] = 0; |
1880 nsIDocShell docShell; | 1859 nsIDocShell docShell; |
1881 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); | 1860 rc = interfaceRequestor.GetInterface (&nsIDocShell.IID, cast(void**)&docShell); |
1882 if (rc !is XPCOM.NS_OK) error (rc); | 1861 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1883 if (docShell is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1862 if (docShell is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1884 //nsIDocShell docShell = new nsIDocShell (result[0]); | 1863 //nsIDocShell docShell = new nsIDocShell (result[0]); |
1885 rc = docShell.LoadStream (inputStream, uri, cast(nsACString*) aContentType, cast(nsACString*)aContentCharset, null); | 1864 rc = docShell.LoadStream (inputStream, uri, cast(nsACString*) aContentType, cast(nsACString*)aContentCharset, null); |
1886 docShell.Release (); | 1865 docShell.Release (); |
1887 } | 1866 } |
1888 } | 1867 } |
1889 if (rc !is XPCOM.NS_OK) error (rc); | 1868 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1890 //result[0] = 0; | 1869 //result[0] = 0; |
1891 | 1870 |
1892 inputStream.Release (); | 1871 inputStream.Release (); |
1893 interfaceRequestor.Release (); | 1872 interfaceRequestor.Release (); |
1894 uri.Release (); | 1873 uri.Release (); |
1902 awaitingNavigate = false; | 1881 awaitingNavigate = false; |
1903 | 1882 |
1904 //int /*long*/[] result = new int /*long*/[1]; | 1883 //int /*long*/[] result = new int /*long*/[1]; |
1905 nsIWebNavigation webNavigation; | 1884 nsIWebNavigation webNavigation; |
1906 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1885 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1907 if (rc !is XPCOM.NS_OK) error (rc); | 1886 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1908 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1887 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1909 | 1888 |
1910 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1889 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1911 //char[] uri = new char[url.length () + 1]; | 1890 //char[] uri = new char[url.length () + 1]; |
1912 //url.getChars (0, url.length (), uri, 0); | 1891 //url.getChars (0, url.length (), uri, 0); |
1913 rc = webNavigation.LoadURI (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); | 1892 rc = webNavigation.LoadURI (url.toString16().toString16z(), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null); |
1920 if (awaitingNavigate) return; | 1899 if (awaitingNavigate) return; |
1921 | 1900 |
1922 nsIWebNavigation webNavigation; | 1901 nsIWebNavigation webNavigation; |
1923 //int /*long*/[] result = new int /*long*/[1]; | 1902 //int /*long*/[] result = new int /*long*/[1]; |
1924 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); | 1903 int rc = webBrowser.QueryInterface (&nsIWebNavigation.IID, cast(void**)&webNavigation); |
1925 if (rc !is XPCOM.NS_OK) error (rc); | 1904 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1926 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1905 if (webNavigation is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1927 | 1906 |
1928 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); | 1907 //nsIWebNavigation webNavigation = new nsIWebNavigation (result[0]); |
1929 rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); | 1908 rc = webNavigation.Stop (nsIWebNavigation.STOP_ALL); |
1930 if (rc !is XPCOM.NS_OK) error (rc); | 1909 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1931 webNavigation.Release (); | 1910 webNavigation.Release (); |
1932 } | 1911 } |
1933 | 1912 |
1934 extern(D) | 1913 extern(D) |
1935 void hookDOMListeners (nsIDOMEventTarget target, bool isTop) { | 1914 void hookDOMListeners (nsIDOMEventTarget target, bool isTop) { |
1982 extern(D) | 1961 extern(D) |
1983 void unhookDOMListeners () { | 1962 void unhookDOMListeners () { |
1984 //int /*long*/[] result = new int /*long*/[1]; | 1963 //int /*long*/[] result = new int /*long*/[1]; |
1985 nsIDOMWindow window; | 1964 nsIDOMWindow window; |
1986 int rc = webBrowser.GetContentDOMWindow (&window); | 1965 int rc = webBrowser.GetContentDOMWindow (&window); |
1987 if (rc !is XPCOM.NS_OK) error (rc); | 1966 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1988 if (window is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1967 if (window is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1989 | 1968 |
1990 //nsIDOMWindow window = new nsIDOMWindow (result[0]); | 1969 //nsIDOMWindow window = new nsIDOMWindow (result[0]); |
1991 //result[0] = 0; | 1970 //result[0] = 0; |
1992 nsIDOMEventTarget target; | 1971 nsIDOMEventTarget target; |
1993 rc = window.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); | 1972 rc = window.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
1994 if (rc !is XPCOM.NS_OK) error (rc); | 1973 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
1995 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1974 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
1996 | 1975 |
1997 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); | 1976 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
1998 //result[0] = 0; | 1977 //result[0] = 0; |
1999 unhookDOMListeners (target); | 1978 unhookDOMListeners (target); |
2000 target.Release (); | 1979 target.Release (); |
2001 | 1980 |
2002 /* Listeners must be unhooked in pages contained in frames */ | 1981 /* Listeners must be unhooked in pages contained in frames */ |
2003 nsIDOMWindowCollection frames; | 1982 nsIDOMWindowCollection frames; |
2004 rc = window.GetFrames (&frames); | 1983 rc = window.GetFrames (&frames); |
2005 if (rc !is XPCOM.NS_OK) error (rc); | 1984 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2006 if (frames is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1985 if (frames is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2007 //nsIDOMWindowCollection frames = new nsIDOMWindowCollection (result[0]); | 1986 //nsIDOMWindowCollection frames = new nsIDOMWindowCollection (result[0]); |
2008 //result[0] = 0; | 1987 //result[0] = 0; |
2009 PRUint32 count; | 1988 PRUint32 count; |
2010 rc = frames.GetLength (&count); /* PRUint32 */ | 1989 rc = frames.GetLength (&count); /* PRUint32 */ |
2011 if (rc !is XPCOM.NS_OK) error (rc); | 1990 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2012 //int count = frameCount[0]; | 1991 //int count = frameCount[0]; |
2013 | 1992 |
2014 if (count > 0) { | 1993 if (count > 0) { |
2015 nsIDOMWindow frame; | 1994 nsIDOMWindow frame; |
2016 for (int i = 0; i < count; i++) { | 1995 for (int i = 0; i < count; i++) { |
2017 rc = frames.Item (i, &frame); | 1996 rc = frames.Item (i, &frame); |
2018 if (rc !is XPCOM.NS_OK) error (rc); | 1997 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2019 if (frame is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 1998 if (frame is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2020 | 1999 |
2021 //nsIDOMWindow frame = new nsIDOMWindow (result[0]); | 2000 //nsIDOMWindow frame = new nsIDOMWindow (result[0]); |
2022 //result[0] = 0; | 2001 //result[0] = 0; |
2023 rc = frame.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); | 2002 rc = frame.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
2024 if (rc !is XPCOM.NS_OK) error (rc); | 2003 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2025 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2004 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2026 | 2005 |
2027 //target = new nsIDOMEventTarget (result[0]); | 2006 //target = new nsIDOMEventTarget (result[0]); |
2028 //result[0] = 0; | 2007 //result[0] = 0; |
2029 unhookDOMListeners (target); | 2008 unhookDOMListeners (target); |
2030 target.Release (); | 2009 target.Release (); |
2169 //XPCOM.memmove (guid, riid, nsID.sizeof); | 2148 //XPCOM.memmove (guid, riid, nsID.sizeof); |
2170 if (*riid == nsIDOMWindow.IID) { | 2149 if (*riid == nsIDOMWindow.IID) { |
2171 nsIDOMWindow aContentDOMWindow; | 2150 nsIDOMWindow aContentDOMWindow; |
2172 //int /*long*/[] aContentDOMWindow = new int /*long*/[1]; | 2151 //int /*long*/[] aContentDOMWindow = new int /*long*/[1]; |
2173 int rc = webBrowser.GetContentDOMWindow (&aContentDOMWindow); | 2152 int rc = webBrowser.GetContentDOMWindow (&aContentDOMWindow); |
2174 if (rc !is XPCOM.NS_OK) error (rc); | 2153 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2175 if (aContentDOMWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2154 if (aContentDOMWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2176 *ppvObject = cast(void*)aContentDOMWindow; | 2155 *ppvObject = cast(void*)aContentDOMWindow; |
2177 //XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF); | 2156 //XPCOM.memmove (ppvObject, aContentDOMWindow, C.PTR_SIZEOF); |
2178 return rc; | 2157 return rc; |
2179 } | 2158 } |
2180 return QueryInterface (riid, ppvObject); | 2159 return QueryInterface (riid, ppvObject); |
2205 */ | 2184 */ |
2206 //int /*long*/[] result = new int /*long*/[1]; | 2185 //int /*long*/[] result = new int /*long*/[1]; |
2207 nsIDOMWindow window; | 2186 nsIDOMWindow window; |
2208 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); | 2187 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
2209 int rc = aWebProgress.GetDOMWindow (&window); | 2188 int rc = aWebProgress.GetDOMWindow (&window); |
2210 if (rc !is XPCOM.NS_OK) error (rc); | 2189 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2211 if (window is null) error (XPCOM.NS_NOINTERFACE); | 2190 if (window is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2212 unhookedDOMWindows ~= window; | 2191 unhookedDOMWindows ~= window; |
2213 } | 2192 } |
2214 } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) !is 0) { | 2193 } else if ((aStateFlags & nsIWebProgressListener.STATE_REDIRECTING) !is 0) { |
2215 if (request is aRequest) request = null; | 2194 if (request is aRequest) request = null; |
2216 } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { | 2195 } else if ((aStateFlags & nsIWebProgressListener.STATE_STOP) !is 0) { |
2223 */ | 2202 */ |
2224 //int /*long*/[] result = new int /*long*/[1]; | 2203 //int /*long*/[] result = new int /*long*/[1]; |
2225 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); | 2204 //nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
2226 nsIDOMWindow domWindow; | 2205 nsIDOMWindow domWindow; |
2227 int rc = aWebProgress.GetDOMWindow (&domWindow); | 2206 int rc = aWebProgress.GetDOMWindow (&domWindow); |
2228 if (rc !is XPCOM.NS_OK) error (rc); | 2207 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2229 if (domWindow is null) error (XPCOM.NS_NOINTERFACE); | 2208 if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2230 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); | 2209 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); |
2231 | 2210 |
2232 //LONG ptrObject = new LONG (result[0]); | 2211 //LONG ptrObject = new LONG (result[0]); |
2233 //result[0] = 0; | 2212 //result[0] = 0; |
2234 int index = unhookedDOMWindows.arrayIndexOf (domWindow); | 2213 int index = unhookedDOMWindows.arrayIndexOf (domWindow); |
2235 if (index !is -1) { | 2214 if (index !is -1) { |
2236 nsIDOMWindow contentWindow; | 2215 nsIDOMWindow contentWindow; |
2237 rc = webBrowser.GetContentDOMWindow (&contentWindow); | 2216 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
2238 if (rc !is XPCOM.NS_OK) error (rc); | 2217 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2239 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2218 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2240 bool isTop = contentWindow is domWindow; | 2219 bool isTop = contentWindow is domWindow; |
2241 contentWindow.Release (); | 2220 contentWindow.Release (); |
2242 //result[0] = 0; | 2221 //result[0] = 0; |
2243 nsIDOMEventTarget target; | 2222 nsIDOMEventTarget target; |
2244 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); | 2223 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
2245 if (rc !is XPCOM.NS_OK) error (rc); | 2224 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2246 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2225 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2247 | 2226 |
2248 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); | 2227 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
2249 //result[0] = 0; | 2228 //result[0] = 0; |
2250 hookDOMListeners (target, isTop); | 2229 hookDOMListeners (target, isTop); |
2251 target.Release (); | 2230 target.Release (); |
2293 */ | 2272 */ |
2294 //int /*long*/[] result = new int /*long*/[1]; | 2273 //int /*long*/[] result = new int /*long*/[1]; |
2295 // nsIWebProgress progress = new nsIWebProgress (aWebProgress); | 2274 // nsIWebProgress progress = new nsIWebProgress (aWebProgress); |
2296 nsIDOMWindow domWindow; | 2275 nsIDOMWindow domWindow; |
2297 int rc = aWebProgress.GetDOMWindow (&domWindow); | 2276 int rc = aWebProgress.GetDOMWindow (&domWindow); |
2298 if (rc !is XPCOM.NS_OK) error (rc); | 2277 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2299 if (domWindow is null) error (XPCOM.NS_NOINTERFACE); | 2278 if (domWindow is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2300 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); | 2279 //nsIDOMWindow domWindow = new nsIDOMWindow (result[0]); |
2301 | 2280 |
2302 //LONG ptrObject = new LONG (result[0]); | 2281 //LONG ptrObject = new LONG (result[0]); |
2303 //result[0] = 0; | 2282 //result[0] = 0; |
2304 int index = unhookedDOMWindows.arrayIndexOf ( domWindow); | 2283 int index = unhookedDOMWindows.arrayIndexOf ( domWindow); |
2305 if (index !is -1) { | 2284 if (index !is -1) { |
2306 nsIDOMWindow contentWindow; | 2285 nsIDOMWindow contentWindow; |
2307 rc = webBrowser.GetContentDOMWindow (&contentWindow); | 2286 rc = webBrowser.GetContentDOMWindow (&contentWindow); |
2308 if (rc !is XPCOM.NS_OK) error (rc); | 2287 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2309 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2288 if (contentWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2310 bool isTop = contentWindow is domWindow; | 2289 bool isTop = contentWindow is domWindow; |
2311 contentWindow.Release (); | 2290 contentWindow.Release (); |
2312 //result[0] = 0; | 2291 //result[0] = 0; |
2313 nsIDOMEventTarget target; | 2292 nsIDOMEventTarget target; |
2314 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); | 2293 rc = domWindow.QueryInterface (&nsIDOMEventTarget.IID, cast(void**)&target); |
2315 if (rc !is XPCOM.NS_OK) error (rc); | 2294 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2316 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2295 if (target is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2317 | 2296 |
2318 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); | 2297 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
2319 //result[0] = 0; | 2298 //result[0] = 0; |
2320 hookDOMListeners (target, isTop); | 2299 hookDOMListeners (target, isTop); |
2321 target.Release (); | 2300 target.Release (); |
2364 //nsIWebProgress webProgress = new nsIWebProgress (aWebProgress); | 2343 //nsIWebProgress webProgress = new nsIWebProgress (aWebProgress); |
2365 | 2344 |
2366 nsIDOMWindow domWindow; | 2345 nsIDOMWindow domWindow; |
2367 //int /*long*/[] aDOMWindow = new int /*long*/[1]; | 2346 //int /*long*/[] aDOMWindow = new int /*long*/[1]; |
2368 int rc = aWebProgress.GetDOMWindow (&domWindow); | 2347 int rc = aWebProgress.GetDOMWindow (&domWindow); |
2369 if (rc !is XPCOM.NS_OK) error (rc); | 2348 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2370 if (domWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2349 if (domWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2371 | 2350 |
2372 //nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); | 2351 //nsIDOMWindow domWindow = new nsIDOMWindow (aDOMWindow[0]); |
2373 //int /*long*/[] aTop = new int /*long*/[1]; | 2352 //int /*long*/[] aTop = new int /*long*/[1]; |
2374 nsIDOMWindow topWindow; | 2353 nsIDOMWindow topWindow; |
2375 rc = domWindow.GetTop (&topWindow); | 2354 rc = domWindow.GetTop (&topWindow); |
2376 if (rc !is XPCOM.NS_OK) error (rc); | 2355 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2377 if (topWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2356 if (topWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2378 domWindow.Release (); | 2357 domWindow.Release (); |
2379 | 2358 |
2380 //nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]); | 2359 //nsIDOMWindow topWindow = new nsIDOMWindow (aTop[0]); |
2381 topWindow.Release (); | 2360 topWindow.Release (); |
2382 | 2361 |
2518 extern(System) | 2497 extern(System) |
2519 nsresult ShowAsModal () { | 2498 nsresult ShowAsModal () { |
2520 //int /*long*/[] result = new int /*long*/[1]; | 2499 //int /*long*/[] result = new int /*long*/[1]; |
2521 nsIServiceManager serviceManager; | 2500 nsIServiceManager serviceManager; |
2522 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | 2501 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
2523 if (rc !is XPCOM.NS_OK) error (rc); | 2502 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2524 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); | 2503 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2525 | 2504 |
2526 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 2505 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
2527 //result[0] = 0; | 2506 //result[0] = 0; |
2528 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); | 2507 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_CONTEXTSTACK_CONTRACTID, true); |
2529 nsIJSContextStack stack; | 2508 nsIJSContextStack stack; |
2530 rc = serviceManager.GetServiceByContractID (XPCOM.NS_CONTEXTSTACK_CONTRACTID.ptr, &nsIJSContextStack.IID, cast(void**)&stack); | 2509 rc = serviceManager.GetServiceByContractID (XPCOM.NS_CONTEXTSTACK_CONTRACTID.ptr, &nsIJSContextStack.IID, cast(void**)&stack); |
2531 if (rc !is XPCOM.NS_OK) error (rc); | 2510 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2532 if (stack is null) error (XPCOM.NS_NOINTERFACE); | 2511 if (stack is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2533 serviceManager.Release (); | 2512 serviceManager.Release (); |
2534 | 2513 |
2535 //nsIJSContextStack stack = new nsIJSContextStack (result[0]); | 2514 //nsIJSContextStack stack = new nsIJSContextStack (result[0]); |
2536 //result[0] = 0; | 2515 //result[0] = 0; |
2537 rc = stack.Push (null); | 2516 rc = stack.Push (null); |
2538 if (rc !is XPCOM.NS_OK) error (rc); | 2517 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2539 | 2518 |
2540 Shell shell = browser.getShell (); | 2519 Shell shell = browser.getShell (); |
2541 Display display = browser.getDisplay (); | 2520 Display display = browser.getDisplay (); |
2542 while (!shell.isDisposed ()) { | 2521 while (!shell.isDisposed ()) { |
2543 if (!display.readAndDispatch ()) display.sleep (); | 2522 if (!display.readAndDispatch ()) display.sleep (); |
2544 } | 2523 } |
2545 JSContext* result; | 2524 JSContext* result; |
2546 rc = stack.Pop (&result); | 2525 rc = stack.Pop (&result); |
2547 if (rc !is XPCOM.NS_OK) error (rc); | 2526 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2548 stack.Release (); | 2527 stack.Release (); |
2549 return XPCOM.NS_OK; | 2528 return XPCOM.NS_OK; |
2550 } | 2529 } |
2551 | 2530 |
2552 extern(System) | 2531 extern(System) |
2601 extern(System) | 2580 extern(System) |
2602 nsresult SetFocus () { | 2581 nsresult SetFocus () { |
2603 //int /*long*/[] result = new int /*long*/[1]; | 2582 //int /*long*/[] result = new int /*long*/[1]; |
2604 nsIBaseWindow baseWindow; | 2583 nsIBaseWindow baseWindow; |
2605 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); | 2584 int rc = webBrowser.QueryInterface (&nsIBaseWindow.IID, cast(void**)&baseWindow); |
2606 if (rc !is XPCOM.NS_OK) error (rc); | 2585 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2607 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE); | 2586 if (baseWindow is null) error (XPCOM.NS_ERROR_NO_INTERFACE, __FILE__, __LINE__); |
2608 | 2587 |
2609 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); | 2588 //nsIBaseWindow baseWindow = new nsIBaseWindow (result[0]); |
2610 rc = baseWindow.SetFocus (); | 2589 rc = baseWindow.SetFocus (); |
2611 if (rc !is XPCOM.NS_OK) error (rc); | 2590 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2612 baseWindow.Release (); | 2591 baseWindow.Release (); |
2613 | 2592 |
2614 /* | 2593 /* |
2615 * Note. Mozilla notifies here that one of the children took | 2594 * Note. Mozilla notifies here that one of the children took |
2616 * focus. This could or should be used to fire an DWT.FOCUS_IN | 2595 * focus. This could or should be used to fire an DWT.FOCUS_IN |
2752 | 2731 |
2753 //nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); | 2732 //nsIDOMEvent domEvent = new nsIDOMEvent (aEvent); |
2754 //int /*long*/[] result = new int /*long*/[1]; | 2733 //int /*long*/[] result = new int /*long*/[1]; |
2755 nsIDOMMouseEvent domMouseEvent; | 2734 nsIDOMMouseEvent domMouseEvent; |
2756 int rc = aEvent.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); | 2735 int rc = aEvent.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
2757 if (rc !is XPCOM.NS_OK) error (rc); | 2736 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2758 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE); | 2737 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2759 | 2738 |
2760 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); | 2739 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
2761 PRInt32 aScreenX, aScreenY; | 2740 PRInt32 aScreenX, aScreenY; |
2762 rc = domMouseEvent.GetScreenX (&aScreenX); | 2741 rc = domMouseEvent.GetScreenX (&aScreenX); |
2763 if (rc !is XPCOM.NS_OK) error (rc); | 2742 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2764 rc = domMouseEvent.GetScreenY (&aScreenY); | 2743 rc = domMouseEvent.GetScreenY (&aScreenY); |
2765 if (rc !is XPCOM.NS_OK) error (rc); | 2744 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2766 domMouseEvent.Release (); | 2745 domMouseEvent.Release (); |
2767 | 2746 |
2768 Event event; | 2747 Event event; |
2769 event.x = aScreenX; | 2748 event.x = aScreenX; |
2770 event.y = aScreenY; | 2749 event.y = aScreenY; |
2845 if (!contentType.equals (XPCOM.CONTENT_MAYBETEXT) && !contentType.equals (XPCOM.CONTENT_MULTIPART)) { | 2824 if (!contentType.equals (XPCOM.CONTENT_MAYBETEXT) && !contentType.equals (XPCOM.CONTENT_MULTIPART)) { |
2846 /* determine whether browser can handle the content type */ | 2825 /* determine whether browser can handle the content type */ |
2847 // int /*long*/[] result = new int /*long*/[1]; | 2826 // int /*long*/[] result = new int /*long*/[1]; |
2848 nsIServiceManager serviceManager; | 2827 nsIServiceManager serviceManager; |
2849 int rc = XPCOM.NS_GetServiceManager (&serviceManager); | 2828 int rc = XPCOM.NS_GetServiceManager (&serviceManager); |
2850 if (rc !is XPCOM.NS_OK) error (rc); | 2829 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2851 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE); | 2830 if (serviceManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2852 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); | 2831 //nsIServiceManager serviceManager = new nsIServiceManager (result[0]); |
2853 //result[0] = 0; | 2832 //result[0] = 0; |
2854 | 2833 |
2855 /* First try to use the nsIWebNavigationInfo if it's available (>= mozilla 1.8) */ | 2834 /* First try to use the nsIWebNavigationInfo if it's available (>= mozilla 1.8) */ |
2856 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID, true); | 2835 //byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_WEBNAVIGATIONINFO_CONTRACTID, true); |
2861 scope auto typePtr = new nsEmbedCString(contentType); | 2840 scope auto typePtr = new nsEmbedCString(contentType); |
2862 //nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); | 2841 //nsIWebNavigationInfo info = new nsIWebNavigationInfo (result[0]); |
2863 //result[0] = 0; | 2842 //result[0] = 0; |
2864 PRUint32 isSupportedResult; /* PRUint32 */ | 2843 PRUint32 isSupportedResult; /* PRUint32 */ |
2865 rc = info.IsTypeSupported (cast(nsACString*)typePtr, null, &isSupportedResult); | 2844 rc = info.IsTypeSupported (cast(nsACString*)typePtr, null, &isSupportedResult); |
2866 if (rc !is XPCOM.NS_OK) error (rc); | 2845 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2867 info.Release (); | 2846 info.Release (); |
2868 //XPCOM.nsEmbedCString_delete (typePtr); | 2847 //XPCOM.nsEmbedCString_delete (typePtr); |
2869 preferred = isSupportedResult !is 0; | 2848 preferred = isSupportedResult !is 0; |
2870 } else { | 2849 } else { |
2871 /* nsIWebNavigationInfo is not available, so do the type lookup */ | 2850 /* nsIWebNavigationInfo is not available, so do the type lookup */ |
2872 //result[0] = 0; | 2851 //result[0] = 0; |
2873 nsICategoryManager categoryManager; | 2852 nsICategoryManager categoryManager; |
2874 rc = serviceManager.GetService (&XPCOM.NS_CATEGORYMANAGER_CID, &nsICategoryManager.IID, cast(void**)&categoryManager); | 2853 rc = serviceManager.GetService (&XPCOM.NS_CATEGORYMANAGER_CID, &nsICategoryManager.IID, cast(void**)&categoryManager); |
2875 if (rc !is XPCOM.NS_OK) error (rc); | 2854 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2876 if (categoryManager is null) error (XPCOM.NS_NOINTERFACE); | 2855 if (categoryManager is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2877 | 2856 |
2878 //nsICategoryManager categoryManager = new nsICategoryManager (result[0]); | 2857 //nsICategoryManager categoryManager = new nsICategoryManager (result[0]); |
2879 //result[0] = 0; | 2858 //result[0] = 0; |
2880 char* categoryBytes = "Gecko-Content-Viewers"; //$NON-NLS-1$ | 2859 char* categoryBytes = "Gecko-Content-Viewers"; //$NON-NLS-1$ |
2881 char* result; | 2860 char* result; |
2968 nsresult HandleEvent (nsIDOMEvent event) { | 2947 nsresult HandleEvent (nsIDOMEvent event) { |
2969 //nsIDOMEvent domEvent = new nsIDOMEvent (event); | 2948 //nsIDOMEvent domEvent = new nsIDOMEvent (event); |
2970 | 2949 |
2971 scope auto type = new nsEmbedString; | 2950 scope auto type = new nsEmbedString; |
2972 int rc = event.GetType (cast(nsAString*)type); | 2951 int rc = event.GetType (cast(nsAString*)type); |
2973 if (rc !is XPCOM.NS_OK) error (rc); | 2952 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2974 //int length = XPCOM.nsEmbedString_Length (type); | 2953 //int length = XPCOM.nsEmbedString_Length (type); |
2975 //int /*long*/ buffer = XPCOM.nsEmbedString_get (type); | 2954 //int /*long*/ buffer = XPCOM.nsEmbedString_get (type); |
2976 //char[] chars = new char[length]; | 2955 //char[] chars = new char[length]; |
2977 //XPCOM.memmove (chars, buffer, length * 2); | 2956 //XPCOM.memmove (chars, buffer, length * 2); |
2978 String typeString = type.toString; | 2957 String typeString = type.toString; |
2980 | 2959 |
2981 if (XPCOM.DOMEVENT_UNLOAD.equals (typeString)) { | 2960 if (XPCOM.DOMEVENT_UNLOAD.equals (typeString)) { |
2982 //int /*long*/[] result = new int /*long*/[1]; | 2961 //int /*long*/[] result = new int /*long*/[1]; |
2983 nsIDOMEventTarget target; | 2962 nsIDOMEventTarget target; |
2984 rc = event.GetCurrentTarget (&target); | 2963 rc = event.GetCurrentTarget (&target); |
2985 if (rc !is XPCOM.NS_OK) error (rc); | 2964 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
2986 if (target is null) error (XPCOM.NS_NOINTERFACE); | 2965 if (target is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
2987 | 2966 |
2988 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); | 2967 //nsIDOMEventTarget target = new nsIDOMEventTarget (result[0]); |
2989 unhookDOMListeners (target); | 2968 unhookDOMListeners (target); |
2990 target.Release (); | 2969 target.Release (); |
2991 return XPCOM.NS_OK; | 2970 return XPCOM.NS_OK; |
2998 | 2977 |
2999 if (XPCOM.DOMEVENT_KEYDOWN.equals (typeString)) { | 2978 if (XPCOM.DOMEVENT_KEYDOWN.equals (typeString)) { |
3000 //int /*long*/[] result = new int /*long*/[1]; | 2979 //int /*long*/[] result = new int /*long*/[1]; |
3001 nsIDOMKeyEvent domKeyEvent; | 2980 nsIDOMKeyEvent domKeyEvent; |
3002 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); | 2981 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
3003 if (rc !is XPCOM.NS_OK) error (rc); | 2982 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3004 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); | 2983 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
3005 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); | 2984 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
3006 //result[0] = 0; | 2985 //result[0] = 0; |
3007 | 2986 |
3008 PRUint32 aKeyCode; /* PRUint32 */ | 2987 PRUint32 aKeyCode; /* PRUint32 */ |
3009 rc = domKeyEvent.GetKeyCode (&aKeyCode); | 2988 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
3010 if (rc !is XPCOM.NS_OK) error (rc); | 2989 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3011 int keyCode = super.translateKey (aKeyCode); | 2990 int keyCode = super.translateKey (aKeyCode); |
3012 | 2991 |
3013 /* | 2992 /* |
3014 * if keyCode is lastKeyCode then either a repeating key like Shift | 2993 * if keyCode is lastKeyCode then either a repeating key like Shift |
3015 * is being held or a key for which key events are not sent has been | 2994 * is being held or a key for which key events are not sent has been |
3026 case DWT.SCROLL_LOCK: | 3005 case DWT.SCROLL_LOCK: |
3027 case DWT.COMMAND: { | 3006 case DWT.COMMAND: { |
3028 /* keypress events will not be received for these keys, so send KeyDowns for them now */ | 3007 /* keypress events will not be received for these keys, so send KeyDowns for them now */ |
3029 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ | 3008 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
3030 rc = domKeyEvent.GetAltKey (&aAltKey); | 3009 rc = domKeyEvent.GetAltKey (&aAltKey); |
3031 if (rc !is XPCOM.NS_OK) error (rc); | 3010 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3032 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); | 3011 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
3033 if (rc !is XPCOM.NS_OK) error (rc); | 3012 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3034 rc = domKeyEvent.GetShiftKey (&aShiftKey); | 3013 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
3035 if (rc !is XPCOM.NS_OK) error (rc); | 3014 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3036 rc = domKeyEvent.GetMetaKey (&aMetaKey); | 3015 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
3037 if (rc !is XPCOM.NS_OK) error (rc); | 3016 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3038 | 3017 |
3039 Event keyEvent = new Event (); | 3018 Event keyEvent = new Event (); |
3040 keyEvent.widget = browser; | 3019 keyEvent.widget = browser; |
3041 keyEvent.type = DWT.KeyDown; | 3020 keyEvent.type = DWT.KeyDown; |
3042 keyEvent.keyCode = keyCode; | 3021 keyEvent.keyCode = keyCode; |
3055 * does not have Meta as a modifier, or has Meta+Ctrl as a modifier, then then do nothing here | 3034 * does not have Meta as a modifier, or has Meta+Ctrl as a modifier, then then do nothing here |
3056 * because its KeyDown event will be sent from the keypress listener. | 3035 * because its KeyDown event will be sent from the keypress listener. |
3057 */ | 3036 */ |
3058 PRBool aMetaKey; /* PRBool */ | 3037 PRBool aMetaKey; /* PRBool */ |
3059 rc = domKeyEvent.GetMetaKey (&aMetaKey); | 3038 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
3060 if (rc !is XPCOM.NS_OK) error (rc); | 3039 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3061 if (aMetaKey !is 0) { | 3040 if (aMetaKey !is 0) { |
3062 PRBool aCtrlKey; /* PRBool */ | 3041 PRBool aCtrlKey; /* PRBool */ |
3063 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); | 3042 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
3064 if (rc !is XPCOM.NS_OK) error (rc); | 3043 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3065 if (aCtrlKey is 0) { | 3044 if (aCtrlKey is 0) { |
3066 PRBool aAltKey, aShiftKey; /* PRBool */ | 3045 PRBool aAltKey, aShiftKey; /* PRBool */ |
3067 rc = domKeyEvent.GetAltKey (&aAltKey); | 3046 rc = domKeyEvent.GetAltKey (&aAltKey); |
3068 if (rc !is XPCOM.NS_OK) error (rc); | 3047 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3069 rc = domKeyEvent.GetShiftKey (&aShiftKey); | 3048 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
3070 if (rc !is XPCOM.NS_OK) error (rc); | 3049 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3071 | 3050 |
3072 Event keyEvent = new Event (); | 3051 Event keyEvent = new Event (); |
3073 keyEvent.widget = browser; | 3052 keyEvent.widget = browser; |
3074 keyEvent.type = DWT.KeyDown; | 3053 keyEvent.type = DWT.KeyDown; |
3075 keyEvent.keyCode = lastKeyCode; | 3054 keyEvent.keyCode = lastKeyCode; |
3107 } | 3086 } |
3108 | 3087 |
3109 //int /*long*/[] result = new int /*long*/[1]; | 3088 //int /*long*/[] result = new int /*long*/[1]; |
3110 nsIDOMKeyEvent domKeyEvent; | 3089 nsIDOMKeyEvent domKeyEvent; |
3111 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); | 3090 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
3112 if (rc !is XPCOM.NS_OK) error (rc); | 3091 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3113 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); | 3092 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
3114 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); | 3093 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
3115 //result[0] = 0; | 3094 //result[0] = 0; |
3116 | 3095 |
3117 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ | 3096 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
3118 rc = domKeyEvent.GetAltKey (&aAltKey); | 3097 rc = domKeyEvent.GetAltKey (&aAltKey); |
3119 if (rc !is XPCOM.NS_OK) error (rc); | 3098 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3120 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); | 3099 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
3121 if (rc !is XPCOM.NS_OK) error (rc); | 3100 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3122 rc = domKeyEvent.GetShiftKey (&aShiftKey); | 3101 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
3123 if (rc !is XPCOM.NS_OK) error (rc); | 3102 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3124 rc = domKeyEvent.GetMetaKey (&aMetaKey); | 3103 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
3125 if (rc !is XPCOM.NS_OK) error (rc); | 3104 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3126 domKeyEvent.Release (); | 3105 domKeyEvent.Release (); |
3127 | 3106 |
3128 PRUint32 aCharCode; /* PRUint32 */ | 3107 PRUint32 aCharCode; /* PRUint32 */ |
3129 rc = domKeyEvent.GetCharCode (&aCharCode); | 3108 rc = domKeyEvent.GetCharCode (&aCharCode); |
3130 if (rc !is XPCOM.NS_OK) error (rc); | 3109 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3131 lastCharCode = aCharCode; | 3110 lastCharCode = aCharCode; |
3132 if (lastCharCode is 0) { | 3111 if (lastCharCode is 0) { |
3133 switch (lastKeyCode) { | 3112 switch (lastKeyCode) { |
3134 case DWT.TAB: lastCharCode = DWT.TAB; break; | 3113 case DWT.TAB: lastCharCode = DWT.TAB; break; |
3135 case DWT.CR: lastCharCode = DWT.CR; break; | 3114 case DWT.CR: lastCharCode = DWT.CR; break; |
3158 | 3137 |
3159 if (XPCOM.DOMEVENT_KEYUP.equals (typeString)) { | 3138 if (XPCOM.DOMEVENT_KEYUP.equals (typeString)) { |
3160 //int /*long*/[] result = new int /*long*/[1]; | 3139 //int /*long*/[] result = new int /*long*/[1]; |
3161 nsIDOMKeyEvent domKeyEvent; | 3140 nsIDOMKeyEvent domKeyEvent; |
3162 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); | 3141 rc = event.QueryInterface (&nsIDOMKeyEvent.IID, cast(void**)&domKeyEvent); |
3163 if (rc !is XPCOM.NS_OK) error (rc); | 3142 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3164 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE); | 3143 if (domKeyEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
3165 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); | 3144 //nsIDOMKeyEvent domKeyEvent = new nsIDOMKeyEvent (result[0]); |
3166 //result[0] = 0; | 3145 //result[0] = 0; |
3167 | 3146 |
3168 PRUint32 aKeyCode; /* PRUint32 */ | 3147 PRUint32 aKeyCode; /* PRUint32 */ |
3169 rc = domKeyEvent.GetKeyCode (&aKeyCode); | 3148 rc = domKeyEvent.GetKeyCode (&aKeyCode); |
3170 if (rc !is XPCOM.NS_OK) error (rc); | 3149 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3171 int keyCode = super.translateKey (aKeyCode); | 3150 int keyCode = super.translateKey (aKeyCode); |
3172 if (keyCode is 0) { | 3151 if (keyCode is 0) { |
3173 /* indicates a key for which key events are not sent */ | 3152 /* indicates a key for which key events are not sent */ |
3174 domKeyEvent.Release (); | 3153 domKeyEvent.Release (); |
3175 return XPCOM.NS_OK; | 3154 return XPCOM.NS_OK; |
3180 lastCharCode = 0; | 3159 lastCharCode = 0; |
3181 } | 3160 } |
3182 | 3161 |
3183 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ | 3162 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
3184 rc = domKeyEvent.GetAltKey (&aAltKey); | 3163 rc = domKeyEvent.GetAltKey (&aAltKey); |
3185 if (rc !is XPCOM.NS_OK) error (rc); | 3164 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3186 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); | 3165 rc = domKeyEvent.GetCtrlKey (&aCtrlKey); |
3187 if (rc !is XPCOM.NS_OK) error (rc); | 3166 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3188 rc = domKeyEvent.GetShiftKey (&aShiftKey); | 3167 rc = domKeyEvent.GetShiftKey (&aShiftKey); |
3189 if (rc !is XPCOM.NS_OK) error (rc); | 3168 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3190 rc = domKeyEvent.GetMetaKey (&aMetaKey); | 3169 rc = domKeyEvent.GetMetaKey (&aMetaKey); |
3191 if (rc !is XPCOM.NS_OK) error (rc); | 3170 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3192 domKeyEvent.Release (); | 3171 domKeyEvent.Release (); |
3193 | 3172 |
3194 Event keyEvent = new Event (); | 3173 Event keyEvent = new Event (); |
3195 keyEvent.widget = browser; | 3174 keyEvent.widget = browser; |
3196 keyEvent.type = DWT.KeyUp; | 3175 keyEvent.type = DWT.KeyUp; |
3216 /* mouse event */ | 3195 /* mouse event */ |
3217 | 3196 |
3218 //int /*long*/[] result = new int /*long*/[1]; | 3197 //int /*long*/[] result = new int /*long*/[1]; |
3219 nsIDOMMouseEvent domMouseEvent; | 3198 nsIDOMMouseEvent domMouseEvent; |
3220 rc = event.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); | 3199 rc = event.QueryInterface (&nsIDOMMouseEvent.IID, cast(void**)&domMouseEvent); |
3221 if (rc !is XPCOM.NS_OK) error (rc); | 3200 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3222 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE); | 3201 if (domMouseEvent is null) error (XPCOM.NS_NOINTERFACE, __FILE__, __LINE__); |
3223 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); | 3202 //nsIDOMMouseEvent domMouseEvent = new nsIDOMMouseEvent (result[0]); |
3224 //result[0] = 0; | 3203 //result[0] = 0; |
3225 | 3204 |
3226 /* | 3205 /* |
3227 * MouseOver and MouseOut events are fired any time the mouse enters or exits | 3206 * MouseOver and MouseOut events are fired any time the mouse enters or exits |
3231 * is within the Browser. | 3210 * is within the Browser. |
3232 */ | 3211 */ |
3233 if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString) || XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { | 3212 if (XPCOM.DOMEVENT_MOUSEOVER.equals (typeString) || XPCOM.DOMEVENT_MOUSEOUT.equals (typeString)) { |
3234 nsIDOMEventTarget eventTarget; | 3213 nsIDOMEventTarget eventTarget; |
3235 rc = domMouseEvent.GetRelatedTarget (&eventTarget); | 3214 rc = domMouseEvent.GetRelatedTarget (&eventTarget); |
3236 if (rc !is XPCOM.NS_OK) error (rc); | 3215 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3237 if (eventTarget !is null) { | 3216 if (eventTarget !is null) { |
3238 domMouseEvent.Release (); | 3217 domMouseEvent.Release (); |
3239 return XPCOM.NS_OK; | 3218 return XPCOM.NS_OK; |
3240 } | 3219 } |
3241 } | 3220 } |
3242 | 3221 |
3243 PRInt32 aClientX, aClientY, aDetail; /* PRInt32 */ | 3222 PRInt32 aClientX, aClientY, aDetail; /* PRInt32 */ |
3244 rc = domMouseEvent.GetClientX (&aClientX); | 3223 rc = domMouseEvent.GetClientX (&aClientX); |
3245 if (rc !is XPCOM.NS_OK) error (rc); | 3224 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3246 rc = domMouseEvent.GetClientY (&aClientY); | 3225 rc = domMouseEvent.GetClientY (&aClientY); |
3247 if (rc !is XPCOM.NS_OK) error (rc); | 3226 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3248 rc = domMouseEvent.GetDetail (&aDetail); | 3227 rc = domMouseEvent.GetDetail (&aDetail); |
3249 if (rc !is XPCOM.NS_OK) error (rc); | 3228 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3250 PRUint16 aButton; /* PRUint16 */ | 3229 PRUint16 aButton; /* PRUint16 */ |
3251 rc = domMouseEvent.GetButton (&aButton); | 3230 rc = domMouseEvent.GetButton (&aButton); |
3252 if (rc !is XPCOM.NS_OK) error (rc); | 3231 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3253 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ | 3232 PRBool aAltKey, aCtrlKey, aShiftKey, aMetaKey; /* PRBool */ |
3254 rc = domMouseEvent.GetAltKey (&aAltKey); | 3233 rc = domMouseEvent.GetAltKey (&aAltKey); |
3255 if (rc !is XPCOM.NS_OK) error (rc); | 3234 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3256 rc = domMouseEvent.GetCtrlKey (&aCtrlKey); | 3235 rc = domMouseEvent.GetCtrlKey (&aCtrlKey); |
3257 if (rc !is XPCOM.NS_OK) error (rc); | 3236 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3258 rc = domMouseEvent.GetShiftKey (&aShiftKey); | 3237 rc = domMouseEvent.GetShiftKey (&aShiftKey); |
3259 if (rc !is XPCOM.NS_OK) error (rc); | 3238 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3260 rc = domMouseEvent.GetMetaKey (&aMetaKey); | 3239 rc = domMouseEvent.GetMetaKey (&aMetaKey); |
3261 if (rc !is XPCOM.NS_OK) error (rc); | 3240 if (rc !is XPCOM.NS_OK) error (rc, __FILE__, __LINE__); |
3262 domMouseEvent.Release (); | 3241 domMouseEvent.Release (); |
3263 | 3242 |
3264 Event mouseEvent = new Event (); | 3243 Event mouseEvent = new Event (); |
3265 mouseEvent.widget = browser; | 3244 mouseEvent.widget = browser; |
3266 mouseEvent.x = aClientX; mouseEvent.y = aClientY; | 3245 mouseEvent.x = aClientX; mouseEvent.y = aClientY; |