Changeset 5082


Ignore:
Timestamp:
Aug 28, 2009, 11:01:45 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #1363: IE8 problems

It seems like it is no longer safe to pass objects between windows. If the window that created the object is closed, the object will no longer be usable in other places. This causes a problems for popup-windows that tried to "remember" the active tab. The information must be stored in the main page, and the array object is created by the popup page. But once the popup was closed, the array could no longer be used. The result was an error message: the object invoked has disconnected from its clients. The solution is to let the main page create the array.

Location:
branches/2.13-stable/www/include/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.13-stable/www/include/scripts/main.js

    r5075 r5082  
    723723 
    724724  /**
     725    Save a key-value pair for a page.
     726  */
     727  this.setPageValue = function(page, key, value)
     728  {
     729    if (!window.top.pageValues) window.top.pageValues = new Array();
     730    if (!window.top.pageValues[page]) window.top.pageValues[page] = new Array();
     731    window.top.pageValues[page][key] = value;
     732  }
     733
     734  /**
     735    Get the saved value for the given key on a page
     736  */
     737  this.getPageValue = function(page, key)
     738  {
     739    if (!window.top.pageValues) return null;
     740    if (!window.top.pageValues[page]) return null;
     741    return window.top.pageValues[page][key];
     742  }
     743
     744  /**
    725745    Get all elements with a given <tag> and class="..."
    726746  */
  • branches/2.13-stable/www/include/scripts/tabcontrol.js

    r4911 r5082  
    124124  this.rememberActiveTab = function(window, tabControlId, tabId)
    125125  {
    126     if (!window.rememberedTabs) window.rememberedTabs = new Array();
    127     var rememberedTabs = window.rememberedTabs;
    128     var thisLocation = location.pathname;
    129     if (!rememberedTabs[thisLocation]) rememberedTabs[thisLocation] = new Array();
    130     rememberedTabs[thisLocation][tabControlId] = tabId;
     126    if (window.Main) window.Main.setPageValue(location.pathname, tabControlId, tabId);
    131127  }
    132128 
    133129  this.getRememberedTabId = function(window, tabControlId)
    134130  {
    135     if (!window.rememberedTabs) return null;
    136     var rememberedTabs = window.rememberedTabs;
    137     var thisLocation = location.pathname;
    138     if (!rememberedTabs[thisLocation]) return null;
    139     return rememberedTabs[thisLocation][tabControlId];
     131    if (!window.Main) return null;
     132    return window.Main.getPageValue(location.pathname, tabControlId);
    140133  }
    141134 
Note: See TracChangeset for help on using the changeset viewer.