void XSLStyleSheetResource::checkNotify()
{
    if (m_data.get())
        m_sheet = decodedText();

    ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
    while (StyleSheetResourceClient* c = w.next())
        c->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
}
Ejemplo n.º 2
0
const String& ScriptResource::script() {
  DCHECK(isLoaded());

  if (m_script.isNull() && data()) {
    String script = decodedText();
    clearData();
    setDecodedSize(script.charactersSizeInBytes());
    m_script = AtomicString(script);
  }

  return m_script;
}
Ejemplo n.º 3
0
const String& ScriptResource::script()
{
    ASSERT(!isPurgeable());
    ASSERT(isLoaded());

    if (!m_script && m_data) {
        String script = decodedText();
        m_data.clear();
        // We lie a it here and claim that script counts as encoded data (even though it's really decoded data).
        // That's because the MemoryCache thinks that it can clear out decoded data by calling destroyDecodedData(),
        // but we can't destroy script in destroyDecodedData because that's our only copy of the data!
        setEncodedSize(script.sizeInBytes());
        m_script = AtomicString(script);
    }

    return m_script.string();
}
Ejemplo n.º 4
0
void CSSStyleSheetResource::checkNotify() {
    // Decode the data to find out the encoding and cache the decoded sheet text.
    if (data())
        setDecodedSheetText(decodedText());

    ResourceClientWalker<StyleSheetResourceClient> w(clients());
    while (StyleSheetResourceClient* c = w.next()) {
        markClientFinished(c);
        c->setCSSStyleSheet(resourceRequest().url(), response().url(), encoding(),
                            this);
    }

    // Clear raw bytes as now we have the full decoded sheet text.
    // We wait for all LinkStyle::setCSSStyleSheet to run (at least once)
    // as SubresourceIntegrity checks require raw bytes.
    // Note that LinkStyle::setCSSStyleSheet can be called from didAddClient too,
    // but is safe as we should have a cached ResourceIntegrityDisposition.
    clearData();
}
Ejemplo n.º 5
0
const String CSSStyleSheetResource::sheetText(
    MIMETypeCheck mimeTypeCheck) const {
    if (!canUseSheet(mimeTypeCheck))
        return String();

    // Use cached decoded sheet text when available
    if (!m_decodedSheetText.isNull()) {
        // We should have the decoded sheet text cached when the resource is fully
        // loaded.
        DCHECK_EQ(getStatus(), Resource::Cached);

        return m_decodedSheetText;
    }

    if (!data() || data()->isEmpty())
        return String();

    return decodedText();
}