Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5820] Titanium.UI.WebView.repaint() method causes exception

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-07-12T22:16:29.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterSheshadri Mantha
AssigneeIngo Muschenetz
Created2011-08-18T10:42:39.000+0000
Updated2017-07-12T22:20:20.000+0000

Description

Using the repaint method of a webview causes exception

Testcase

var win = Ti.UI.createWindow({
  backgroundColor:'#fff',
  layout:'vertical',
  exitOnClose:true
});

var webview = Ti.UI.createWebView({url:'http://www.google.com'});

win.add(webview);

win.open();

webview.addEventListener('load', function(e){
  Ti.API.info('*** webview for '+ e.url +' has loaded - repainting now... ***');
  Ti.UI.WebView.repaint();
});

Result

The webview is rendered, but repaint then causes the following exception:
519                   TiAPI  I  (kroll$1: app://app.js) [7538,9013] *** webview for http://www.google.co.uk/ has loaded - repainting now
                          ... ***
519           KrollCallback  E  (kroll$1: app://app.js) [391,9404] ECMA Error evaluating source, invocation: [callMethod UI.WebView.UI.W
                          ebView:event:load null], message: TypeError: Cannot call method "repaint" of undefined (file:///android_
                          asset/Resources/app.js#87)
519           KrollCallback  E  org.mozilla.javascript.EcmaError: TypeError: Cannot call method "repaint" of undefined (file:///android_
                          asset/Resources/app.js#87)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3784)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3762)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3790)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3809)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3828)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2333)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2326)
519           KrollCallback  E  	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1514)
519           KrollCallback  E  	at script(file:///android_asset/Resources/app.js:87)
519           KrollCallback  E  	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
519           KrollCallback  E  	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
519           KrollCallback  E  	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
519           KrollCallback  E  	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3177)
519           KrollCallback  E  	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
519           KrollCallback  E  	at org.appcelerator.titanium.kroll.KrollCallback.callSync(KrollCallback.java:139)
519           KrollCallback  E  	at org.appcelerator.titanium.kroll.KrollCallback$1.run(KrollCallback.java:164)
519           KrollCallback  E  	at android.os.Handler.handleCallback(Handler.java:587)
519           KrollCallback  E  	at android.os.Handler.dispatchMessage(Handler.java:92)
519           KrollCallback  E  	at android.os.Looper.loop(Looper.java:123)
519           KrollCallback  E  	at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
519               TiJSError  E  (kroll$1: app://app.js) [41,9445] ----- Titanium Javascript Runtime Error -----
519               TiJSError  E  (kroll$1: app://app.js) [4,9449] - In file:///android_asset/Resources/app.js:87,0
519               TiJSError  E  (kroll$1: app://app.js) [2,9451] - Message: TypeError: Cannot call method "repaint" of undefined (file:/
                          //android_asset/Resources/app.js#87)
519               TiJSError  E  (kroll$1: app://app.js) [1,9452] - Source: null

Possible Cause

While there are references to repaint in the ios source, none exist in Android. Is this platform-specific function, that requires an APIDoc rather than an Android ticket?

Attachments

FileDateSize
app.js2011-10-20T14:25:39.000+00002106

Comments

  1. Paul Dowsett 2011-08-20

    Sheshadri Rather than post comments to your own ticket, please edit the body and include all the information requested in the [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist). Once this ticket is in the correct format, I can move it to the relevant project. Thank you for your help
  2. Paul Dowsett 2011-08-31

    Sheshadri Please see the cloned ticket for the information that must be provided here in order for us to progress it. Thank you
  3. Paul Dowsett 2011-09-02

    Sheshadri Please would you add the code that will reproduce this problem. Read [Creating Good Use-cases](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases) for information. Also, please use the markup syntax to better format the body of this ticket. See the question mark icon at the bottom of the comments box for help. In particular, add a \{code\} block around the stack trace. Then I can move this ticket across. Thank you
  4. Sheshadri Mantha 2011-09-02

    ?? REALLY ?? The code is described in the use case -- i'm sure your developers can figure it out. I don't know if you are a developer... but a good developer can easily figure this out. Besides it a clone of an already reported issue -- have you guys actually tried to duplicate this issue ?? Why are you making me jump through hoops? I understand that you / your developers need the appropriate info and I have provided sufficient information from which any good developer can reproduce this issue! As this issue was blocking my app, i've used other methods to complete my work... so what you see here is salvaged from old code... i would personally follow the use-case.
       function doLogin() {
       	var client = Titanium.Network.createHTTPClient();
       	
       	client.onload = function() {
       		Ti.API.info('RAW ='+this.responseText);
       		var loading = false;
       		if(this.status == '200') {
       			Ti.API.info('got my response, http status code ' + this.status);
       			if(this.readyState == 4) {
       				Ti.API.info('headers:' + this.getResponseHeader('Set-Cookie'));
       				webview = Titanium.UI.createWebView();
       				
       				webview.html = this.responseText;
       				win.add(webview);
       				win.modal = true;
       				webview.repaint();
       
       				var response=JSON.parse(this.responseText);
       				Ti.API.info('Response = '+response);
       			} else {
       				alert('HTTP Ready State != 4');
       			}
       		} else {
       			alert('HTTp Error Response Status Code = '+this.status);
       			Ti.API.error("Error =>"+this.response);
       		}
       	};
       	var param = "username="+username.value+"&password="+password.value;
       	Ti.API.info('param={' + param + '}');
       	client.open('POST', url);
       	client.send(param);
       }
       
    Oh! and assume that doLogin is called on click of button or some event handler and all other variables are properly defined.
  5. Paul Dowsett 2011-09-05

    Sheshadri I am sorry that this review process is inconvenient for you, but I hope you can understand that it is used reluctantly, out of necessity, in order to make the best use of our very limited resources. With an open ticketing system like this, we can be overwhelmed by reports of very differing levels of quality. I have lost count of the number of supposed bugs that I have personally tested, containing code that on first inspection looked "ok", only to discover that the user was at fault. As you will imagine, they are extremely time-consuming, and can easily get overwhelming. Also bear in mind that the faster that our core team can get an example of your issue running in their environment, the sooner they can start coding a fix. This insures the fastest turnaround for your issue, especially when competing with other equally-important tickets that contain fully-working code. Our guidelines are published in [Submitting Bug Reports](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-SubmittingBugReports), and are, I'm afraid, a prerequisite to raising tickets. If this issue is still important to you, then I would be happy to move it across to the main project when the code is complete. Thank you.
  6. Sheshadri Mantha 2011-09-06

    Paul; As i've said before, i *do* appreciate the need for guidelines in submitting bugs... my original report was a duplicate, and i did provide all the details albeit not in form you were satisfied with. And while i did "complain", i *did make all the changes* that you've requested. Do you *still* believe this report to be unsatisfactory for submittal to developers? If not, could you please forward this to your developer? While i personally have no need for a fix for this in my current project, i imagine that it will enhance adoptability of your platform -- after all it is a crash! I am happy to engage in any dialog that they need to reproduce this. Thanks.
  7. Matthew Apperson 2011-10-20

    Sheshadri, I am sorry to make another request of you, but our guidelines for creating a ticket state the following about use-cases: * use a sequential set of Titanium API calls rather than namespaces and custom functions. Don't worry about polluting the global scope; a usecase should be too small for this to be relevant * rely on default values where possible; remove any properties that are not absolutely necessary * insure your code runs without any modification when copied into a blank app.js file. You would normally create one windows at the very least, to make it clear when the app has started Thank you for working so hard to get this ticket in. Best regards, Matt
  8. Sheshadri Mantha 2011-10-20

    WOW! I can't think of *ANYTHING* POSITIVE to say about your open-source bug fixing process. I am only trying to help you and you make me jump through hoops ? 1) you don't tell me whats wrong with the use case but repeatedly point to your guidelines -- what? 2) have you tried copying the use case code and testing it? Have you tried to repaint a webview widget? AND *please* don't ask me to tell your developers how to create a webview! It's your app and it crashes. Be thankful for my time!
  9. Matthew Apperson 2011-10-20

    Sheshadri, We have a small team, and hundreds of bug reports and feature request to filter through, some are valid and some are not. I have not yet run your code as I would have to recreate a small app around it, as aposed to the instructions in the guidelines to "insure your code runs without any modification when copied into a blank app.js file. You would normally create one windows at the very least, to make it clear when the app has started" It is not that we dont know how to do this, or even that we dont want to, but it is no posible to re-create every issue, we just dont have the man power as Paul already stated. Best regards, Matt
  10. Matthew Apperson 2011-10-20

    Also to note is that we do request that the code goes in the ticket, due to the fact that the comments will no longer exist once we accept the ticket into the core project.
  11. Sheshadri Mantha 2011-10-20

    *FINE* Here is an app.js which reproduces it completely. What is it? a) The default app.js with the 2 tabs b) added the code to invoke webview.repaint() BTW: it still crashes!
  12. Paul Dowsett 2011-10-20

    Please see the revised code - the most minimal, least-complex, code that is possible in order to reproduce the bug.
  13. Sheshadri Mantha 2011-10-20

    OK - I understand now. Thanks for your triage. Hope this report serves your platform well.
  14. Paul Dowsett 2011-10-20

    Sheshadri - thank you for persisting with us to get it to this point! This was well-spotted, and very useful to get either fixed or documented as platform-specific. Cheers
  15. Lee Morris 2017-07-12

    Closing ticket due to time passed and lack of progress for a number of years. Please open a new ticket if there are any problems.

JSON Source