Re: webkit scriptengine & multiple plasmoids

2009-12-27 Thread Artur Souza (MoRpHeUz)
I talked to simon about this and he said that the right place is
webkit bug tracker even if it is a bug in the qt part. Cheers

On 12/27/09, Petri Damstén  wrote:
> On Tuesday 22 December 2009 23:40:19 Aaron J. Seigo wrote:
>> On December 20, 2009, Petri Damstén wrote:
>> > On Friday 18 December 2009 00:17:19 Marco Martin wrote:
>> > > On Thursday 17 December 2009, Petri Damstén wrote:
>> > > > Hi,
>> > > >
>> > > > I'm trying to fix this bug: http://www.kde-
>> > > > look.org/content/show.php/Scripted+Image?content=91749 (Error having
>> > > > 2 of them). Seems that if there is two (or more) same webkit
>> > > > plasmoids on desktop only one of them loads properly on plasma
>> > > > start.
>> > > > When same plasmoid B load is started before A load is finished
>> > > > javascript functions don't get called. This happens only when
>> > > > plasmoids are same e.g. two scripted-image plasmoids. I made
>> > > > attached
>> > > > patch to load plasmoids with the same plugin name in queue and it
>> > > > seems to solve this but I'm not sure if this right way to do it?
>> > > >
>> > > > Petri
>> > >
>> > > seems an hacky workaround, but i can'r really think about a possible
>> > > real cause of this...
>> > > could be a bug in webkit itself, maybe has some internal sigleton
>> > > class
>> > >  that gets in an inconsistent state when two pages load the same url
>> > > in
>> > > the same moment? seems terribly unlikely but...
>> >
>> > I can reproduce this bug with a small Qt only app
>> > (http://aryhma.oy.cx/damu/webkit-test.tar.gz). It seems that if the same
>> > javascript file is included in multiple html files that are loaded at
>> > the
>> >  same time then loadFinished signal is emitted too early. Should this
>> > have a workaround in webkit script engine until this is fixed in
>> > Qt/webkit?
>>
>> if it has been reported against Qt/Webkit, then yes, we can have a
>> (documented) work around in the code that we can remove when Qt/Webkit is
>> fixed.
>
> Noticed that if javascript is embedded in html it works, so this could have
> a
> work around also on those rare webkit applets that are run in multiple
> instances.
>
> Qt bug tracker seems to recommend webkit bug tracker for webkit bugs but
> this
> bug is related to qt/webkit signals (of course it still might be a webkit
> bug)
> so I'm not sure what would be the right place for the report.
>
> Petri
>

-- 
Sent from my mobile device

---
Artur Duque de Souza
OpenBossa Research Labs
INdT - Instituto Nokia de Tecnologia
---
Blog: http://labs.morpheuz.eng.br/blog/
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
---
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: webkit scriptengine & multiple plasmoids

2009-12-27 Thread Petri Damstén
On Tuesday 22 December 2009 23:40:19 Aaron J. Seigo wrote:
> On December 20, 2009, Petri Damstén wrote:
> > On Friday 18 December 2009 00:17:19 Marco Martin wrote:
> > > On Thursday 17 December 2009, Petri Damstén wrote:
> > > > Hi,
> > > >
> > > > I'm trying to fix this bug: http://www.kde-
> > > > look.org/content/show.php/Scripted+Image?content=91749 (Error having
> > > > 2 of them). Seems that if there is two (or more) same webkit
> > > > plasmoids on desktop only one of them loads properly on plasma start.
> > > > When same plasmoid B load is started before A load is finished
> > > > javascript functions don't get called. This happens only when
> > > > plasmoids are same e.g. two scripted-image plasmoids. I made attached
> > > > patch to load plasmoids with the same plugin name in queue and it
> > > > seems to solve this but I'm not sure if this right way to do it?
> > > >
> > > > Petri
> > >
> > > seems an hacky workaround, but i can'r really think about a possible
> > > real cause of this...
> > > could be a bug in webkit itself, maybe has some internal sigleton class
> > >  that gets in an inconsistent state when two pages load the same url in
> > > the same moment? seems terribly unlikely but...
> >
> > I can reproduce this bug with a small Qt only app
> > (http://aryhma.oy.cx/damu/webkit-test.tar.gz). It seems that if the same
> > javascript file is included in multiple html files that are loaded at the
> >  same time then loadFinished signal is emitted too early. Should this
> > have a workaround in webkit script engine until this is fixed in
> > Qt/webkit?
> 
> if it has been reported against Qt/Webkit, then yes, we can have a
> (documented) work around in the code that we can remove when Qt/Webkit is
> fixed.

Noticed that if javascript is embedded in html it works, so this could have a 
work around also on those rare webkit applets that are run in multiple 
instances. 

Qt bug tracker seems to recommend webkit bug tracker for webkit bugs but this 
bug is related to qt/webkit signals (of course it still might be a webkit bug) 
so I'm not sure what would be the right place for the report.

Petri


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: webkit scriptengine & multiple plasmoids

2009-12-22 Thread Aaron J. Seigo
On December 20, 2009, Petri Damstén wrote:
> On Friday 18 December 2009 00:17:19 Marco Martin wrote:
> > On Thursday 17 December 2009, Petri Damstén wrote:
> > > Hi,
> > >
> > > I'm trying to fix this bug: http://www.kde-
> > > look.org/content/show.php/Scripted+Image?content=91749 (Error having 2
> > > of them). Seems that if there is two (or more) same webkit plasmoids on
> > > desktop only one of them loads properly on plasma start. When same
> > > plasmoid B load is started before A load is finished javascript
> > > functions don't get called. This happens only when plasmoids are same
> > > e.g. two scripted-image plasmoids. I made attached patch to load
> > > plasmoids with the same plugin name in queue and it seems to solve this
> > > but I'm not sure if this right way to do it?
> > >
> > > Petri
> >
> > seems an hacky workaround, but i can'r really think about a possible real
> > cause of this...
> > could be a bug in webkit itself, maybe has some internal sigleton class
> >  that gets in an inconsistent state when two pages load the same url in
> > the same moment? seems terribly unlikely but...
> 
> I can reproduce this bug with a small Qt only app
> (http://aryhma.oy.cx/damu/webkit-test.tar.gz). It seems that if the same
> javascript file is included in multiple html files that are loaded at the
>  same time then loadFinished signal is emitted too early. Should this have
>  a workaround in webkit script engine until this is fixed in Qt/webkit?

if it has been reported against Qt/Webkit, then yes, we can have a 
(documented) work around in the code that we can remove when Qt/Webkit is 
fixed.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: webkit scriptengine & multiple plasmoids

2009-12-20 Thread Petri Damstén
On Friday 18 December 2009 00:17:19 Marco Martin wrote:
> On Thursday 17 December 2009, Petri Damstén wrote:
> > Hi,
> >
> > I'm trying to fix this bug: http://www.kde-
> > look.org/content/show.php/Scripted+Image?content=91749 (Error having 2 of
> > them). Seems that if there is two (or more) same webkit plasmoids on
> >  desktop only one of them loads properly on plasma start. When same
> >  plasmoid B load is started before A load is finished javascript
> > functions don't get called. This happens only when plasmoids are same
> > e.g. two scripted-image plasmoids. I made attached patch to load
> > plasmoids with the same plugin name in queue and it seems to solve this
> > but I'm not sure if this right way to do it?
> >
> > Petri
> 
> seems an hacky workaround, but i can'r really think about a possible real
> cause of this...
> could be a bug in webkit itself, maybe has some internal sigleton class
>  that gets in an inconsistent state when two pages load the same url in the
>  same moment? seems terribly unlikely but...

I can reproduce this bug with a small Qt only app 
(http://aryhma.oy.cx/damu/webkit-test.tar.gz). It seems that if the same 
javascript file is included in multiple html files that are loaded at the same 
time then loadFinished signal is emitted too early. Should this have a 
workaround in webkit script engine until this is fixed in Qt/webkit?

Petri


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: webkit scriptengine & multiple plasmoids

2009-12-18 Thread Petri Damstén
On Friday 18 December 2009 00:17:19 Marco Martin wrote:
> On Thursday 17 December 2009, Petri Damstén wrote:
> > Hi,
> >
> > I'm trying to fix this bug: http://www.kde-
> > look.org/content/show.php/Scripted+Image?content=91749 (Error having 2 of
> > them). Seems that if there is two (or more) same webkit plasmoids on
> >  desktop only one of them loads properly on plasma start. When same
> >  plasmoid B load is started before A load is finished javascript
> > functions don't get called. This happens only when plasmoids are same
> > e.g. two scripted-image plasmoids. I made attached patch to load
> > plasmoids with the same plugin name in queue and it seems to solve this
> > but I'm not sure if this right way to do it?
> >
> > Petri
> 
> seems an hacky workaround, but i can'r really think about a possible real
> cause of this...
> could be a bug in webkit itself, maybe has some internal sigleton class
>  that gets in an inconsistent state when two pages load the same url in the
>  same moment? seems terribly unlikely but...

Yes it's hacky and I don't like it either. Debugged a little more and noticed 
that if webkit is already loading the same page it emits loadFinished right 
away for the next pages. I would guess that loadFinished is emitted too early 
and calling init fails because javascript is not yet ready.

Petri

koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1ba51d0) 
"webkit-test"
koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1bcbe60) 
"webkit-test"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1bcbe60) "webkit-test"
koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1bd31d0) 
"webkit-test"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1bd31d0) "webkit-test"
koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1bdf020) 
"webkit-test"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1bdf020) "webkit-test"
koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1bedd10) 
"scriptedimage"
koe(5356)/plasma WebApplet::init: Loading frame:  QWebFrame(0x1bda090) 
"scriptedimage"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1bda090) "scriptedimage"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1ba51d0) "webkit-test"
koe(5356)/plasma WebApplet::loadFinished: Load finished for frame:  
QWebFrame(0x1bedd10) "scriptedimage"


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: webkit scriptengine & multiple plasmoids

2009-12-17 Thread Marco Martin
On Thursday 17 December 2009, Petri Damstén wrote:
> Hi,
> 
> I'm trying to fix this bug: http://www.kde-
> look.org/content/show.php/Scripted+Image?content=91749 (Error having 2 of
> them). Seems that if there is two (or more) same webkit plasmoids on
>  desktop only one of them loads properly on plasma start. When same
>  plasmoid B load is started before A load is finished javascript functions
>  don't get called. This happens only when plasmoids are same e.g. two
>  scripted-image plasmoids. I made attached patch to load plasmoids with the
>  same plugin name in queue and it seems to solve this but I'm not sure if
>  this right way to do it?
> 
> Petri
> 
seems an hacky workaround, but i can'r really think about a possible real 
cause of this...
could be a bug in webkit itself, maybe has some internal sigleton class that 
gets in an inconsistent state when two pages load the same url in the same 
moment? seems terribly unlikely but...

-- 
Marco Martin
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


webkit scriptengine & multiple plasmoids

2009-12-17 Thread Petri Damstén
Hi,

I'm trying to fix this bug: http://www.kde-
look.org/content/show.php/Scripted+Image?content=91749 (Error having 2 of 
them). Seems that if there is two (or more) same webkit plasmoids on desktop 
only one of them loads properly on plasma start. When same plasmoid B load is 
started before A load is finished javascript functions don't get called. This 
happens only when plasmoids are same e.g. two scripted-image plasmoids. I made 
attached patch to load plasmoids with the same plugin name in queue and it 
seems to solve this but I'm not sure if this right way to do it?

Petri
Index: webapplet.cpp
===
--- webapplet.cpp	(revision 1063166)
+++ webapplet.cpp	(working copy)
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,8 +68,13 @@
 
 Plasma::WebView *page;
 bool loaded;
+KUrl url;
+QString webpage;
+static QMap loading;
 };
 
+QMap WebApplet::Private::loading;
+
 WebApplet::WebApplet(QObject *parent, const QVariantList &args)
 : AppletScript(parent),
   d(new Private)
@@ -86,20 +92,31 @@
 d->init(this);
 
 QString webpage;
-webpage = package()->filePath("mainscript");
+d->webpage = package()->filePath("mainscript");
 
-if (webpage.isEmpty()) {
+if (d->webpage.isEmpty()) {
 kDebug() << "fail! no page";
 delete d->page;
 d->page = 0;
 return false;
 }
-KUrl url(package()->filePath("html"));
-kDebug() << webpage << package()->path() << url;
-d->page->mainFrame()->setHtml(dataFor(webpage), url);
+d->url = KUrl(package()->filePath("html"));
+kDebug() << d->webpage << package()->path() << d->url;
+load();
 return true;
 }
 
+void WebApplet::load()
+{
+if (!d->loading.contains(package()->metadata().pluginName()) ||
+!d->loading[package()->metadata().pluginName()]) {
+d->loading[package()->metadata().pluginName()] = true;
+d->page->mainFrame()->setHtml(dataFor(d->webpage), d->url);
+} else {
+QTimer::singleShot(50, this, SLOT(load()));
+}
+}
+
 void WebApplet::paintInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option,
const QRect &contentsRect)
@@ -116,6 +133,7 @@
 
 void WebApplet::loadFinished(bool success)
 {
+d->loading[package()->metadata().pluginName()] = false;
 d->loaded = success;
 }
 
Index: webapplet.h
===
--- webapplet.h	(revision 1063166)
+++ webapplet.h	(working copy)
@@ -56,6 +56,7 @@
 void connectFrame(QWebFrame *);
 virtual void loadFinished(bool);
 virtual void initJsObjects();
+void load();
 
 private:
 class Private;


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel