Reinitializing the context when clearing the V8 proxy for navigation makes us hold on to a context object per frame that we should not hold on to. Reinitialization is not necessary. When updating the document wrapper cache, we check that the global object handle is not empty, we should be checking the context.
Created attachment 32591 [details] patch to avoid leaking contexts
Comment on attachment 32591 [details] patch to avoid leaking contexts These seem like two independent changes, but that's ok. I don't understand why calling initContextIfNeeded() in clearForNavigation() leads to a leak, but it makes sense that this isn't needed because all the other entry points are super excited about making sure the context is initialized before they use it. I'm r+ing this, but it would be helpful for Dimitri to give his opinion as well.
I am pretty sure this will work, but please make sure this doesn't break any layout tests.
I ran all layout tests in both release and debug mode before uploading the patch and saw no new failures with this change. Adam, Dimitri, could one of you land this patch for me?
(In reply to comment #4) > Adam, Dimitri, could one of you land this patch for me? Sure, but we should wait for the canary to compile before landing this so we can see if there are regressions.
A note for the future: Please make sure to put a link to the bug in the changelog.
Committed as http://trac.webkit.org/changeset/45797