Cleaner.smali
.class public Lorg/jsoup/safety/Cleaner;
.super Ljava/lang/Object;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lorg/jsoup/safety/Cleaner$ElementMeta;,
Lorg/jsoup/safety/Cleaner$CleaningVisitor;
}
.end annotation
# instance fields
.field private a:Lorg/jsoup/safety/Whitelist;
# direct methods
.method public constructor <init>(Lorg/jsoup/safety/Whitelist;)V
.registers 2
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
invoke-static {p1}, Lorg/jsoup/helper/Validate;->notNull(Ljava/lang/Object;)V
iput-object p1, p0, Lorg/jsoup/safety/Cleaner;->a:Lorg/jsoup/safety/Whitelist;
return-void
.end method
.method static synthetic a(Lorg/jsoup/safety/Cleaner;)Lorg/jsoup/safety/Whitelist;
.registers 1
iget-object p0, p0, Lorg/jsoup/safety/Cleaner;->a:Lorg/jsoup/safety/Whitelist;
return-object p0
.end method
.method static synthetic b(Lorg/jsoup/safety/Cleaner;Lorg/jsoup/nodes/Element;)Lorg/jsoup/safety/Cleaner$ElementMeta;
.registers 2
invoke-direct {p0, p1}, Lorg/jsoup/safety/Cleaner;->d(Lorg/jsoup/nodes/Element;)Lorg/jsoup/safety/Cleaner$ElementMeta;
move-result-object p0
return-object p0
.end method
.method private c(Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Element;)I
.registers 5
new-instance v0, Lorg/jsoup/safety/Cleaner$CleaningVisitor;
const/4 v1, 0x0
invoke-direct {v0, p0, p1, p2, v1}, Lorg/jsoup/safety/Cleaner$CleaningVisitor;-><init>(Lorg/jsoup/safety/Cleaner;Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Element;Lorg/jsoup/safety/Cleaner$1;)V
invoke-static {v0, p1}, Lorg/jsoup/select/NodeTraversor;->traverse(Lorg/jsoup/select/NodeVisitor;Lorg/jsoup/nodes/Node;)V
invoke-static {v0}, Lorg/jsoup/safety/Cleaner$CleaningVisitor;->a(Lorg/jsoup/safety/Cleaner$CleaningVisitor;)I
move-result p1
return p1
.end method
.method private d(Lorg/jsoup/nodes/Element;)Lorg/jsoup/safety/Cleaner$ElementMeta;
.registers 9
invoke-virtual {p1}, Lorg/jsoup/nodes/Element;->tagName()Ljava/lang/String;
move-result-object v0
new-instance v1, Lorg/jsoup/nodes/Attributes;
invoke-direct {v1}, Lorg/jsoup/nodes/Attributes;-><init>()V
new-instance v2, Lorg/jsoup/nodes/Element;
invoke-static {v0}, Lorg/jsoup/parser/Tag;->valueOf(Ljava/lang/String;)Lorg/jsoup/parser/Tag;
move-result-object v3
invoke-virtual {p1}, Lorg/jsoup/nodes/Element;->baseUri()Ljava/lang/String;
move-result-object v4
invoke-direct {v2, v3, v4, v1}, Lorg/jsoup/nodes/Element;-><init>(Lorg/jsoup/parser/Tag;Ljava/lang/String;Lorg/jsoup/nodes/Attributes;)V
invoke-virtual {p1}, Lorg/jsoup/nodes/Element;->attributes()Lorg/jsoup/nodes/Attributes;
move-result-object v3
invoke-virtual {v3}, Lorg/jsoup/nodes/Attributes;->iterator()Ljava/util/Iterator;
move-result-object v3
const/4 v4, 0x0
:goto_1f
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
move-result v5
if-eqz v5, :cond_3a
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v5
check-cast v5, Lorg/jsoup/nodes/Attribute;
iget-object v6, p0, Lorg/jsoup/safety/Cleaner;->a:Lorg/jsoup/safety/Whitelist;
invoke-virtual {v6, v0, p1, v5}, Lorg/jsoup/safety/Whitelist;->b(Ljava/lang/String;Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Attribute;)Z
move-result v6
if-eqz v6, :cond_37
invoke-virtual {v1, v5}, Lorg/jsoup/nodes/Attributes;->put(Lorg/jsoup/nodes/Attribute;)Lorg/jsoup/nodes/Attributes;
goto :goto_1f
:cond_37
add-int/lit8 v4, v4, 0x1
goto :goto_1f
:cond_3a
iget-object p1, p0, Lorg/jsoup/safety/Cleaner;->a:Lorg/jsoup/safety/Whitelist;
invoke-virtual {p1, v0}, Lorg/jsoup/safety/Whitelist;->a(Ljava/lang/String;)Lorg/jsoup/nodes/Attributes;
move-result-object p1
invoke-virtual {v1, p1}, Lorg/jsoup/nodes/Attributes;->addAll(Lorg/jsoup/nodes/Attributes;)V
new-instance p1, Lorg/jsoup/safety/Cleaner$ElementMeta;
invoke-direct {p1, v2, v4}, Lorg/jsoup/safety/Cleaner$ElementMeta;-><init>(Lorg/jsoup/nodes/Element;I)V
return-object p1
.end method
# virtual methods
.method public clean(Lorg/jsoup/nodes/Document;)Lorg/jsoup/nodes/Document;
.registers 4
invoke-static {p1}, Lorg/jsoup/helper/Validate;->notNull(Ljava/lang/Object;)V
invoke-virtual {p1}, Lorg/jsoup/nodes/Element;->baseUri()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Lorg/jsoup/nodes/Document;->createShell(Ljava/lang/String;)Lorg/jsoup/nodes/Document;
move-result-object v0
invoke-virtual {p1}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v1
if-eqz v1, :cond_1c
invoke-virtual {p1}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object p1
invoke-virtual {v0}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v1
invoke-direct {p0, p1, v1}, Lorg/jsoup/safety/Cleaner;->c(Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Element;)I
:cond_1c
return-object v0
.end method
.method public isValid(Lorg/jsoup/nodes/Document;)Z
.registers 4
invoke-static {p1}, Lorg/jsoup/helper/Validate;->notNull(Ljava/lang/Object;)V
invoke-virtual {p1}, Lorg/jsoup/nodes/Element;->baseUri()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Lorg/jsoup/nodes/Document;->createShell(Ljava/lang/String;)Lorg/jsoup/nodes/Document;
move-result-object v0
invoke-virtual {p1}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v1
invoke-virtual {v0}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v0
invoke-direct {p0, v1, v0}, Lorg/jsoup/safety/Cleaner;->c(Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Element;)I
move-result v0
if-nez v0, :cond_29
invoke-virtual {p1}, Lorg/jsoup/nodes/Document;->head()Lorg/jsoup/nodes/Element;
move-result-object p1
invoke-virtual {p1}, Lorg/jsoup/nodes/Node;->childNodes()Ljava/util/List;
move-result-object p1
invoke-interface {p1}, Ljava/util/List;->isEmpty()Z
move-result p1
if-eqz p1, :cond_29
const/4 p1, 0x1
goto :goto_2a
:cond_29
const/4 p1, 0x0
:goto_2a
return p1
.end method
.method public isValidBodyHtml(Ljava/lang/String;)Z
.registers 8
const-string v0, ""
invoke-static {v0}, Lorg/jsoup/nodes/Document;->createShell(Ljava/lang/String;)Lorg/jsoup/nodes/Document;
move-result-object v1
invoke-static {v0}, Lorg/jsoup/nodes/Document;->createShell(Ljava/lang/String;)Lorg/jsoup/nodes/Document;
move-result-object v2
const/4 v3, 0x1
invoke-static {v3}, Lorg/jsoup/parser/ParseErrorList;->tracking(I)Lorg/jsoup/parser/ParseErrorList;
move-result-object v4
invoke-virtual {v2}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v5
invoke-static {p1, v5, v0, v4}, Lorg/jsoup/parser/Parser;->parseFragment(Ljava/lang/String;Lorg/jsoup/nodes/Element;Ljava/lang/String;Lorg/jsoup/parser/ParseErrorList;)Ljava/util/List;
move-result-object p1
invoke-virtual {v2}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v0
const/4 v5, 0x0
invoke-virtual {v0, v5, p1}, Lorg/jsoup/nodes/Element;->insertChildren(ILjava/util/Collection;)Lorg/jsoup/nodes/Element;
invoke-virtual {v2}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object p1
invoke-virtual {v1}, Lorg/jsoup/nodes/Document;->body()Lorg/jsoup/nodes/Element;
move-result-object v0
invoke-direct {p0, p1, v0}, Lorg/jsoup/safety/Cleaner;->c(Lorg/jsoup/nodes/Element;Lorg/jsoup/nodes/Element;)I
move-result p1
if-nez p1, :cond_34
invoke-virtual {v4}, Ljava/util/ArrayList;->isEmpty()Z
move-result p1
if-eqz p1, :cond_34
goto :goto_35
:cond_34
const/4 v3, 0x0
:goto_35
return v3
.end method