H
hzgt9b
I know how to overwrite a function. Normally this is what I would do:
function someFunction() { /* orig definition here */ }
//later in the execution stream I would do...
someFunction = function () { /* overwrite function definition */ }
The above works fine for me even when someFunction is originally
defined in a seperate frame other than the code that overwrites it
(obviously on the same domain).
What I don't know how to-do is overwrite a prototype function that
already loaded into memory on another frame (on the same domain). For
example:
//say, this prototype function is defined on a frame named
'frame1'
String.prototype.someOtherFunction() { /* define prototype
function here */ }
Problem is I don't know how to access the prototype function from
another frame. I've tried
//assume we are not (executing) in 'frame1'
top.frame1.String.prototype.someOtherFunction = function () { /*
overwrite function here */ }
top.frame1.someOtherFunction = function () { /* overwrite
function here */ } //this just defines a new function in frame1
Is this possible? Can someone give me some pointers?
function someFunction() { /* orig definition here */ }
//later in the execution stream I would do...
someFunction = function () { /* overwrite function definition */ }
The above works fine for me even when someFunction is originally
defined in a seperate frame other than the code that overwrites it
(obviously on the same domain).
What I don't know how to-do is overwrite a prototype function that
already loaded into memory on another frame (on the same domain). For
example:
//say, this prototype function is defined on a frame named
'frame1'
String.prototype.someOtherFunction() { /* define prototype
function here */ }
Problem is I don't know how to access the prototype function from
another frame. I've tried
//assume we are not (executing) in 'frame1'
top.frame1.String.prototype.someOtherFunction = function () { /*
overwrite function here */ }
top.frame1.someOtherFunction = function () { /* overwrite
function here */ } //this just defines a new function in frame1
Is this possible? Can someone give me some pointers?