Overriding native methods and objects INSIDE a particular object
<p>I'm trying to override a native method called "localStorage" for functions INSIDE an object.</p>

<p>Here's a gist of what I'm trying to do:</p>

<pre><code>function SomeObject(){
   this.localStorage = "aaa"; //block access to localStorage for functions INSIDE this object.
      ... (some more code here)
   _testRun(){
      window.testA = localStorage; //chose to store the instance on a window (global-like) object
   }
   this.testRun = function(){ _testRun(); };
   this.testRun2 = function(){ window.testB = localStorage;};v
}
var a = new SomeObject();
a.testRun();
a.testRun2();

(after this, when I look up window.testA and window.testB, they both point to the Native localStorage, not the custom one inside the SomeObject.)
</code></pre>

<p>BTW, I don't want to override a native function for the whole document.
(i.e. might use native localStorage OUTSIDE the object)</p>

<p>Any suggestions/solutions on how I can do this? thanks!</p>
