Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone Browser #58

Open
Migrate opened this issue Aug 1, 2011 · 0 comments
Open

Clone Browser #58

Migrate opened this issue Aug 1, 2011 · 0 comments

Comments

@Migrate
Copy link

Migrate commented Aug 1, 2011

Hi,

I've create a clone browser function so I can create new browser with the same cookieJar.

browser.js:

/**
 * Clone a new `Browser` with the same cookieJar, external options and userAgent as the sourceBrowser.
 *
 * @param {Object} source browser.
 * @api public
 */
Browser.prototype.cloneBrowser = function(sourceBrowser) {
    this.external = sourceBrowser.external;
    this.cookieJar = sourceBrowser.cookieJar;
    this.userAgent = sourceBrowser.userAgent;
};

tobi.js:

/**
 * Initialize a new `Browser` with the same cookieJar and userAgent 
 */
exports.cloneBrowser = function(a,b,c,d){
  new_browser = new exports.Browser(a,b,c);
  new_browser.cloneBrowser(d)
  return new_browser;
};

I need this function because I have several hosts that share the same cookies.

default_browser = tobi.createBrowser(80, default_host, { external: true });
new_brower = tobi.cloneBrowser(80, new_host, {}, browser);

Can you please add this function (or something similar) to the next release?
Thanks.
Best regards,
Migrate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant