Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/parser/html/nsHtml5AutoPauseUpdate.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=2 sw=2 et tw=78: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef nsHtml5AutoPauseUpdate_h
8
#define nsHtml5AutoPauseUpdate_h
9
10
class MOZ_RAII nsHtml5AutoPauseUpdate final
11
{
12
private:
13
  RefPtr<nsHtml5DocumentBuilder> mBuilder;
14
15
public:
16
  explicit nsHtml5AutoPauseUpdate(nsHtml5DocumentBuilder* aBuilder)
17
    : mBuilder(aBuilder)
18
0
  {
19
0
    mBuilder->EndDocUpdate();
20
0
  }
21
  ~nsHtml5AutoPauseUpdate()
22
0
  {
23
0
    // Something may have terminated the parser during the update pause.
24
0
    if (!mBuilder->IsComplete()) {
25
0
      mBuilder->BeginDocUpdate();
26
0
    }
27
0
  }
28
};
29
30
#endif // nsHtml5AutoPauseUpdate_h