PDA

View Full Version : [CLOSED][3.0rc2] Firefox 3.5 - strange e.browserEvent when using onstorage event



dolittle
30 Jun 2009, 10:47 PM
Hi,

[Ext3RC2]I'm working with DOM storage in FF3.5.
e.browserEvent gives me strange properties:
like type: "mousemove"

To reproduce it add the following code to panels.js in the ext examples:

Ext.onReady(function(){

Ext.getDoc().on('storage', function(e){
alert('test');
debugger;
});

var p = new Ext.Panel({
title: 'My Panel',
collapsible:true,
renderTo: 'panel-basic',
width:400,
html: Ext.example.bogusMarkup,
buttons: [{
text: 'set',
handler: function() {
window.localStorage['test'] = 'foo';
}
}, {
text: 'get',
handler: function(){
var val = window.localStorage['test'];
}
}]
});

...
When working with addEventListener the event properties are fine:

document.addEventListener('storage', function(e, b, c, d){
alert('storage');
debugger;
}, false);

evant
1 Jul 2009, 3:32 AM
Can you provide more information? Using the example you posted I couldn't get any events to fire in FF 3.5.

Animal
1 Jul 2009, 3:48 AM
e.browserEvent examined in Firebug? :)):))

dolittle
1 Jul 2009, 4:01 AM
Can you provide more information? Using the example you posted I couldn't get any events to fire in FF 3.5.
When you click on the "set" button you write 'foo' to the 'test' filed of the localStorage.
You should get an alert('test') and then the debugger will let you examine the ext event e and the e.browserEvent.


e.browserEvent examined in Firebug?
I don't get the joke.
From ext docs:

browserEvent : Object
The normal browser event
Are you making fun of me?
Is it usual for this company to laugh at customers?

Animal
1 Jul 2009, 4:07 AM
What company is that then? I'm not a "company".

And you are not my customer. Just someone I'm trying to get on the right track. For free.

The browser event is a singleton. if you break, and then move the mouse, the browser event will be a mouse move event!

http://en.wikipedia.org/wiki/Observer_effect_%28information_technology%29

dolittle
1 Jul 2009, 4:13 AM
What company is that then? I'm not a "company".

And you are not my customer. Just someone I'm trying to get on the right track. For free.

Your title says

Ext Support Team
So you represent a company and it doesn't matter if you do it for free.



The browser event is a singleton. if you break, and then move the mouse, the browser event will be a mouse move event!

http://en.wikipedia.org/wiki/Observe..._technology%29
You could have said that in the first place but you want to be mysterious and vague.

Maybe ext can clone the event properties to prevent it from changing.

evant
1 Jul 2009, 4:31 AM
It already does clone the event properties, it happens inside setEvent().

Is there something I need to enable in the browser settings to get local storage working? Does it have to run through a web server?

Animal
1 Jul 2009, 4:34 AM
Your title says

So you represent a company and it doesn't matter if you do it for free.


That's NOTHING to do with me.


You could have said that in the first place but you want to be mysterious and vague.

I'm constantly trying to get people to think.

I hit this exact same thing, thought about it, figured out what was happening and submitted a request that the Ext,EventObject could copy the properties out of the browser event.


Maybe ext can clone the event properties to prevent it from changing.

It does.

dolittle
1 Jul 2009, 4:45 AM
It already does clone the event properties, it happens inside setEvent().

Is there something I need to enable in the browser settings to get local storage working? Does it have to run through a web server?
I didn't change anything in the default FF3.5.
It has to be a browser that support DOM storage - IE8/Safari4/FF3.5
I used FF3.5 and I'm not sure how the other behave.

I'm using a web server but I don't know if it is required or not.
Windows XP, Apache(XAMPP), FF3.5

If Ext already copy the browserEvent properties in Ext3.0RC2, I don't understand why I see
'mousewheel' event in firebug and I don't understand the first comment by Animal.

dolittle
1 Jul 2009, 4:48 AM
Just verified that you have to use a web server.
Sorry about that.

mystix
1 Jul 2009, 5:37 AM
Is there something I need to enable in the browser settings to get local storage working? Does it have to run through a web server?

it's part of the HTML5 spec:
http://www.whatwg.org/specs/web-apps/current-work/#manually-releasing-the-storage-mutex
(search for localStorage)

and is available on the following browsers:
http://robertnyman.com/javascript/#javascript-dom-storage-compatibility

evant
1 Jul 2009, 5:49 AM
Yeah, I needed to have it run through a web server. Anyway, I can't reproduce this,

For example:



Ext.onReady(function(){

Ext.getDoc().on('storage', function(e){
console.log(e.type);
});

var p = new Ext.Panel({
title: 'My Panel',
collapsible:true,
renderTo: document.body,
width:400,
html: 'foo',
buttons: [{
text: 'set',
handler: function() {
window.localStorage['test'] = 'foo';
}
}, {
text: 'get',
handler: function(){
var val = window.localStorage['test'];
}
}]
});
});


It consistently prints storage. If you log the event object, it goes a bit funky but this could be an issue with Firebug.

dolittle
1 Jul 2009, 6:01 AM
It consistently prints storage. If you log the event object, it goes a bit funky but this could be an issue with Firebug.

If Ext Copy the browserEvent properties I don't see why is it a Firebug issue.
Will Ext debug console eliminate firebug?

onstorage will soon have 'source' and 'domain' properties that's why I need access to the browser event.

Maybe Animal the genius can help us an teach me how to think.

evant
1 Jul 2009, 6:14 AM
@doLittle, look at the setEvent method in EventManager, that's where the event was copied. When I said FireBug was strange, I meant once you inspect the event object using Fbug you can get odd results. Whether this is a bug with firebug or not, I don't know.

mystix
1 Jul 2009, 7:25 AM
Firebug 1.4.0b3 on Fx3.5 is strange.
what works perfectly fine in FB1.3.3 on Fx3.0.11 barfs in FB1.4.0b3 on Fx3.5.

try this in both for example:


new Date();

and then go WTH?!?!

also try inspecting the Ext object.
the very first property is undefined. like, what the heck.

in fact, just doing this alone in the console:


a = {};

followed by a simple


a

reveals lots of problems. just how buggy FB1.4 is.

evant
1 Jul 2009, 8:50 AM
Yeah, that's what I was referring to. Keep in mind it's still in beta. Going to mark this as closed, you can always bump it later if it turns out there's a problem.