Replacing StorageImpl with itself?

39 views
Skip to first unread message

Edward Scott

unread,
Apr 21, 2017, 3:34:19 AM4/21/17
to GWT Users
hello - 

I am looking for some insight into what might be going on with the workaround to Wrong LocalStorage event fire #9205, an issue raised about a year and a half ago.

I have observed the behavior described in the issue. I have also followed the workaround described in the comments and found that it does work around the issue.

The workaround is to add the following configuration, which appears to replace StorageImpl with itself:

  <replace-with class="com.google.gwt.storage.client.StorageImpl">
   
<when-type-is class="com.google.gwt.storage.client.StorageImpl" />
   
<any>
     
<when-property-is name="user.agent" value="safari" />
     
<when-property-is name="user.agent" value="ie9" />
     
<when-property-is name="user.agent" value="ie10" />
     
<when-property-is name="user.agent" value="gecko1_8" />
   
</any>
 
</replace-with>

I am trying to understand - why does this change anything?

Thomas Broyer

unread,
Apr 21, 2017, 3:45:09 AM4/21/17
to GWT Users
This rule overrides the "built-in" one that replaces StorageImpl with StorageImplNonNativeEvents. It wouldn't be needed if that other rule hadn't existed.

Edward Scott

unread,
Apr 24, 2017, 3:20:35 PM4/24/17
to GWT Users
OK this is starting to make sense to me now.

It sounds like defaulting to StorageImplNonNativeEvents is intended to avoid browser compatibility problems since some browsers have not fully implemented StorageEvents, and does so by eliminating it, bringing all browsers down to the lowest common denominator, and thenr replacing it with a similar behavior similuated within GWT.

But if I configure my GWT application to use StorageImpl for certain browsers with the configuration change described in this thread I can then make full use of StorageEvents in browsers that support it, as long as I am conscious of different behavior in different browsers.
Reply all
Reply to author
Forward
0 new messages