(1) This section applies only in a criminal proceeding.
(2) A person who, when required to give evidence, is the domestic partner, parent or child of a defendant may object to being required—
(a) to give evidence; or
(b) to give evidence of a communication between the person and the defendant;
as a witness for the prosecution.
(3) The objection must be made before the person gives the evidence or as soon as practicable after the person becomes aware of the right to object, whichever is the later.
(4) If it appears to the court that a person may have a right to make an objection under this section, the court must satisfy itself that the person is aware of the effect of this section as it may apply to the person.
(5) If there is a jury, the court must hear and decide any objection under this section in the jury's absence.
(6) A person who makes an objection under this section to giving evidence or giving evidence of a communication must not be required to give the evidence if the court finds that—
(a) there is a likelihood that harm would or might be caused (whether directly or indirectly) to the person, or to the relationship between the person and the defendant, if the person gives the evidence; and
(b) the nature and extent of that harm outweighs the desirability of having the evidence given.
(7) Without limiting the matters that may be taken into account by the court for subsection (6), it must take into account the following:
(a) the nature and gravity of the offence for which the defendant is being prosecuted;
(b) the substance and importance of any evidence that the person might give and the weight that is likely to be attached to it;
(c) whether any other evidence about the matters to which the evidence of the person would relate is reasonably available to the prosecutor;
(d) the nature of the relationship between the defendant and the person;
(e) whether, in giving the evidence, the person would have to disclose matter that was received by the person in confidence from the defendant.
(8) If an objection under this section has been decided, the prosecutor may not comment on—
(a) the objection; or
(b) the decision of the court in relation to the objection; or
(c) the failure of the person to give evidence.