Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: Source/core/testing/v8/WebCoreTestSupport.cpp

Issue 1309673004: Have resetInternalsObject() handle detached documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: syntax Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void resetInternalsObject(v8::Local<v8::Context> context) 61 void resetInternalsObject(v8::Local<v8::Context> context)
62 { 62 {
63 // This can happen if JavaScript is disabled in the main frame. 63 // This can happen if JavaScript is disabled in the main frame.
64 if (context.IsEmpty()) 64 if (context.IsEmpty())
65 return; 65 return;
66 66
67 ScriptState* scriptState = ScriptState::from(context); 67 ScriptState* scriptState = ScriptState::from(context);
68 ScriptState::Scope scope(scriptState); 68 ScriptState::Scope scope(scriptState);
69 Page* page = toDocument(scriptState->executionContext())->frame()->page(); 69 Document* document = toDocument(scriptState->executionContext());
70 ASSERT(document);
71 LocalFrame* frame = document->frame();
72 // Should the document have been detached, the page is assumed being destroy ed (=> no reset required.)
73 if (!frame)
74 return;
75 Page* page = frame->page();
70 ASSERT(page); 76 ASSERT(page);
71 Internals::resetToConsistentState(page); 77 Internals::resetToConsistentState(page);
72 InternalSettings::from(*page)->resetToConsistentState(); 78 InternalSettings::from(*page)->resetToConsistentState();
73 } 79 }
74 80
75 } 81 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698