Closed Bug 82134 Opened 24 years ago Closed 7 years ago

Jpanel, JTabbedPane, Panel cannot be used to create a WebClient.

Categories

(Core Graveyard :: Java APIs to WebShell, defect)

x86
Windows 98
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
mozilla1.0.1

People

(Reporter: jeet_shahani, Assigned: edburns)

Details

Attachments

(4 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20010131 Netscape6/6.01 BuildID: This is a very consistent bug. This bug results in a developer not being able to instantiate a JPanel which creates a BrowserCanvas and BrowserControl. The bug fails when doing a navigation.loadUrl. This inturn delegates to NavigationImpl.loadUrl(). It fails on the Assert statement: Assert.assert(-1 != nativeWebShell); This is strange because it does create the BrowserCanvas, which is not visible till loadurl is called. This fails when trying to instantiate other components also(JTabbedPane, Panel) that create a browsercanvas. However, it does work if the browsercanvas is instantiated in JFrame and Frame instead. I am using jre1.3.0_01 in Win95 and WebClient 1.0. I can submit proper code which will result in the above. Thanks. Reproducible: Always Steps to Reproduce: 1)Create a Frame or a JFrame. 2)Extend a JPanel. 3)Instantiate a browserCanvas in JPanel using queryinterface method. 4)Assert works. 5)calling the navigation.loadUrl fails (at NavigationImpl.loadUrl()) 6)It fails on the line where it does.. Assert.assert(-1 != nativeWebShell); This happens when adding with Panel and JTabbedPane too. Actual Results: WebClient never viewable. Expected Results: To be able to instantiate the JPanel this way.. This is a very consistent bug. This bug results in a developer not being able to instantiate a JPanel which creates a BrowserCanvas and BrowserControl. The bug fails when doing a navigation.loadUrl. This inturn delegates to NavigationImpl.loadUrl(). It fails on the Assert statement: Assert.assert(-1 != nativeWebShell); This is strange because it does create the BrowserCanvas, which is not visible till loadurl is called. This fails when trying to instantiate other components also(JTabbedPane, Panel) that create a browsercanvas. However, it does work if the browsercanvas is instantiated in JFrame and Frame instead. I am using jre1.3.0_01 in Win95 and WebClient 1.0. I can submit proper code which will result in the above. Thanks.
Whoops, wrong bug for this attachment :-(
Jeet, can you please attach some code to reproduce this? I'm very interested in fixing this bug.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Here is the stack trace. BTW, this error also occurs when you add the browserCanvas to an internalframe. Is there a workaround, uncommenting the assertion or something?? C:\WebClient\java\webclient\classes_spec>java org.mozilla.webclient.test.MyEMJP %MOZILLA_FIVE_HOME% url 1..http://www.yahoo.com constructed with binDir: C:\PROGRA~1\Netscape\NETSCA~1 url: http://www.yahoo.com in BrowserControlCanvas setBounds: x = 0 y = 0 w = 640 h = 480 native library does implement webclient.WindowControl Can't setBounds(java.awt.Rectangle[x=0,y=0,width=639,height=479]) null native library does implement webclient.Navigation org.mozilla.util.AssertionFailureException native library does implement webclient.EventRegistration org.mozilla.util.AssertionFailureException Exception in thread "main" org.mozilla.util.AssertionFailureException at org.mozilla.util.Assert.assert(Assert.java:122) at org.mozilla.webclient.wrapper_native.NavigationImpl.loadURL(Navigatio nImpl.java:83) at org.mozilla.webclient.test.MyEMJP.<init>(MyEMJP.java:191) at org.mozilla.webclient.test.MyEMJP.main(MyEMJP.java:773)
Hi Ed, The JPanel fails in the NavigationImpl.loadURL method on the Assert statement below. Hope this helps. public void loadURL(String absoluteURL) { ParameterCheck.nonNull(absoluteURL); myFactory.throwExceptionIfNotInitialized(); Assert.assert(-1 != nativeWebShell); synchronized(myBrowserControl) { nativeLoadURL(nativeWebShell, absoluteURL); } }
Hi Ed, The JPanel fails in the NavigationImpl.loadURL method on the Assert statement below. Hope this helps. public void loadURL(String absoluteURL) { ParameterCheck.nonNull(absoluteURL); myFactory.throwExceptionIfNotInitialized(); Assert.assert(-1 != nativeWebShell); synchronized(myBrowserControl) { nativeLoadURL(nativeWebShell, absoluteURL); } } So that I know, in future, is it better to post the code here in bugzilla as opposed to on the newsgroups. Thanks.
Ed Burns
Status: ASSIGNED → NEW
Target Milestone: --- → mozilla0.9.6
Too late for 0.9.6, this needs retargeting.
0.9.6 is long gone. -> 0.9.7
Target Milestone: mozilla0.9.6 → mozilla0.9.7
0.9.7 is long gone as well..
attachment 35609 [details] should be marked obsolete as per comment #2
Target Milestone: mozilla0.9.7 → mozilla1.0.1
I'm looking at this now.
Status: NEW → ASSIGNED
I found another issue when placing the BrowserControlCanvas in a JSplitPane here the size of the pane that holds the BrowserControlCanvas may be enlarged by resizing the JSplitPane's divider, however the pane cannot be made smaller. Investigating this, I found that JSplitPane is relying on the minimum size of the component in the pane that is being resized to determine if the pane can be made smaller. The minimum size of the BrowserControlCanvas is being returned as the current size of the canvas, which causes the JSplitPane not to be able to shrink the pane. Investigating further, I found that this is due to the way java.awt.Component determines the minimum size of a component. If the Component does not have a peer component, which in the case of the BrowserControlCanvas it does not, then the [current] size of the component is used. To make things work for me, I added some code to BrowserControlCanvas to manage the minimum size: -- an attribute to hold the minimum size, type java.awt.Dimension -- public void setMinimumSize() to set the attribute -- public Dimension getMinimumSize(), overriding java.awt.Component to return the value. This allows me to set the minimum size of the BrowserControlCanvas from the class that is inserting it into the JScrollPane. This change requires some work to be done by the client of BrowserControlCanvas, setting the minimum size, but it makes no assumptions about the minimum size if it is not explicitly set, maintaining the previous behavior. As a side-effect to making this change, I am now able to add the BrowserControlCanvas to a Panel (or JPanel) and it works, which I think addresses this bug.
I'm also having this problem using Webclient 1.3 The problem seems to be that for some reason the Event queue is never created. I get these messages when I'm running the program: [java] +++ In appInitialize - after createWrapperFactory +++ [java] in BrowserControlCanvas setBounds: x = 0 y = 0 w = 800 h = 600 [java] native library does implement webclient.WindowControl [java] Can't setBounds(java.awt.Rectangle[x=0,y=0,width=799,height=599]) null [java] in BrowserControlCanvas setBounds: x = 5 y = 25 w = -10 h = -30 [java] Webclient-Gdk-ERROR **: BadMatch (invalid parameter attributes) [java] serial 2187 error_code 8 request_code 42 minor_code 0 [java] in BrowserControlCanvas setBounds: x = 0 y = 20 w = 11 h = 6 [java] in BrowserControlCanvas setBounds: x = 0 y = 20 w = 11 h = 6 [java] in BrowserControlCanvas setBounds: x = 0 y = 20 w = 402 h = 200 Then while the program is exiting the event queue seems to start just before the program finishes shutting-down: [java] (QFA)Talkback error: Can't initialize. [java] Creating Event Queue [java] InitMozillaStuff(8496258): Create the action queue [java] Init the baseWindow [java] Create the BaseWindow... [java] Creation Done..... [java] Show the webBrowser
Brian: are you using the stock test browser or your own one? If so, could you post a code snippet that would allow me to reproduce it? Ed
Does this patch replicate the problem? I can't replicate the problem with the latest code.
Ed, your patch did not reproduce the problem, I sent an attachment that does. OS should be All since the original bug was in Win98 and I reproduced under Linux. This is using Webclient 1.3
Attachment #123689 - Attachment mime type: application/octet-stream → text/plain
Ok, this is _not_ JPanel dependant. What I was doing wrong (and I assume this was the original reporter's problem as well due to the same symtoms) was calling browserControl.queryInterface(BrowserControl.NAVIGATION_NAME); before the window was displayed. I've done some further testing and determined that if you call browserControl.queryInterface(BrowserControl.NAVIGATION_NAME); before the Canvas is displayed then the webclient will not be usable. Even if you do another call to browserControl.queryInterface(BrowserControl.NAVIGATION_NAME); after it's visible the navigation still wont work. I imagine that other browserControl.queryInterface() options might cause the same issue, but I haven't tested this. I now initialize my navigation variable with a null value and initialize it if it's null immediatly before I go to use it, which is always after it's been displayed.
Does not qualify as a blocker.
Severity: blocker → normal
Product: Core → Core Graveyard
Java APIs to WebShell isn't a thing anymore. Closing.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: